private Object [ ] parseFeature ( 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 ( ) ; } Object [ ] values = new Object [ cachedColumnIndex . size ( ) + 1 ] ; if ( field . equalsIgnoreCase ( GeoJsonField . GEOMETRY ) ) { setGeometry ( jp , values ) ; jp . nextToken ( ) ; } else if ( field . equalsIgnoreCase ( GeoJsonField . PROPERTIES ) ) { parseProperties ( jp , values ) ; 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 ) ) { setGeometry ( jp , values ) ; } else if ( secondParam . equalsIgnoreCase ( GeoJsonField . PROPERTIES ) ) { parseProperties ( jp , values ) ; } while ( jp . nextToken ( ) != JsonToken . END_OBJECT ) ; //END_OBJECT } feature } return values ; }
Features in GeoJSON contain a geometry object and additional properties This method returns all values stored in a feature .