private void parseFeatureMetadata ( JsonParser jp ) throws IOException , SQLException { jp . nextToken ( ) ; String field = jp . getText ( ) ; //Avoid all token which are not 'properties', 'geometry', 'type' while ( ! field . equalsIgnoreCase ( GeoJsonField . GEOMETRY ) && ! field . equalsIgnoreCase ( GeoJsonField . PROPERTIES ) && ! jp . getCurrentToken ( ) . equals ( JsonToken . END_OBJECT ) ) { jp . nextToken ( ) ; if ( jp . getCurrentToken ( ) . equals ( JsonToken . START_ARRAY ) || jp . getCurrentToken ( ) . equals ( JsonToken . START_OBJECT ) ) { jp . skipChildren ( ) ; } jp . nextToken ( ) ; field = jp . getText ( ) ; } // FIELD_NAME geometry if ( field . equalsIgnoreCase ( GeoJsonField . GEOMETRY ) ) { parseParentGeometryMetadata ( jp ) ; hasGeometryField = true ; jp . nextToken ( ) ; } else if ( field . equalsIgnoreCase ( GeoJsonField . PROPERTIES ) ) { parsePropertiesMetadata ( jp ) ; jp . nextToken ( ) ; } //If there is only one geometry field in the feature them the next //token corresponds to the end object of the feature //Avoid all token which are not 'properties', 'geometry', 'type' field = jp . getText ( ) ; while ( ! field . equalsIgnoreCase ( GeoJsonField . GEOMETRY ) && ! field . equalsIgnoreCase ( GeoJsonField . PROPERTIES ) && ! jp . getCurrentToken ( ) . equals ( JsonToken . END_OBJECT ) ) { jp . nextToken ( ) ; if ( jp . getCurrentToken ( ) . equals ( JsonToken . START_ARRAY ) || jp . getCurrentToken ( ) . equals ( JsonToken . START_OBJECT ) ) { jp . skipChildren ( ) ; } jp . nextToken ( ) ; field = jp . getText ( ) ; } if ( jp . getCurrentToken ( ) != JsonToken . END_OBJECT ) { String secondParam = jp . getText ( ) ; // field name if ( secondParam . equalsIgnoreCase ( GeoJsonField . GEOMETRY ) ) { parseParentGeometryMetadata ( jp ) ; hasGeometryField = true ; } else if ( secondParam . equalsIgnoreCase ( GeoJsonField . PROPERTIES ) ) { parsePropertiesMetadata ( jp ) ; } while ( jp . nextToken ( ) != JsonToken . END_OBJECT ) ; //END_OBJECT } feature } }
Features in GeoJSON contain a geometry object and additional properties This method is used to collect metadata