/** * Parses a sequence of coordinates array expressed as * * [ [100.0, 0.0], [101.0, 1.0] ] * * and check if it's wellformated * * @param jp * @throws IOException * @throws SQLException * @return Coordinate[] */ private void parseCoordinatesMetadata(JsonParser jp) throws IOException { jp.nextToken(); // START_ARRAY [ to parse the each positions while (jp.getCurrentToken() != JsonToken.END_ARRAY) { parseCoordinateMetadata(jp); } }
/** * Parses a sequence of coordinates array expressed as * * [ [100.0, 0.0], [101.0, 1.0] ] * * and check if it's wellformated * * @param jp * @throws IOException * @throws SQLException * @return Coordinate[] */ private void parseCoordinatesMetadata(JsonParser jp) throws IOException { jp.nextToken(); // START_ARRAY [ to parse the each positions while (jp.getCurrentToken() != JsonToken.END_ARRAY) { parseCoordinateMetadata(jp); } }
/** * Parses a sequence of coordinates array expressed as * * [ [100.0, 0.0], [101.0, 1.0] ] * * and check if it's wellformated * * @param jp * @throws IOException * @throws SQLException * @return Coordinate[] */ private void parseCoordinatesMetadata(JsonParser jp) throws IOException { jp.nextToken(); // START_ARRAY [ to parse the each positions while (jp.getCurrentToken() != JsonToken.END_ARRAY) { parseCoordinateMetadata(jp); } }
/** * Parses a point and check if it's wellformated * * Syntax: * * { "type": "Point", "coordinates": [100.0, 0.0] } * * @param jp * @throws IOException */ private void parsePointMetadata(JsonParser jp) throws IOException, SQLException { jp.nextToken(); // FIELD_NAME coordinates String coordinatesField = jp.getText(); if (coordinatesField.equalsIgnoreCase(GeoJsonField.COORDINATES)) { jp.nextToken(); // START_ARRAY [ to parse the coordinate parseCoordinateMetadata(jp); } else { throw new SQLException("Malformed GeoJSON file. Expected 'coordinates', found '" + coordinatesField + "'"); } }
/** * Parses a point and check if it's wellformated * * Syntax: * * { "type": "Point", "coordinates": [100.0, 0.0] } * * @param jp * @throws IOException */ private void parsePointMetadata(JsonParser jp) throws IOException, SQLException { jp.nextToken(); // FIELD_NAME coordinates String coordinatesField = jp.getText(); if (coordinatesField.equalsIgnoreCase(GeoJsonField.COORDINATES)) { jp.nextToken(); // START_ARRAY [ to parse the coordinate parseCoordinateMetadata(jp); } else { throw new SQLException("Malformed GeoJSON file. Expected 'coordinates', found '" + coordinatesField + "'"); } }
/** * Parses a point and check if it's wellformated * * Syntax: * * { "type": "Point", "coordinates": [100.0, 0.0] } * * @param jp * @throws IOException */ private void parsePointMetadata(JsonParser jp) throws IOException, SQLException { jp.nextToken(); // FIELD_NAME coordinates String coordinatesField = jp.getText(); if (coordinatesField.equalsIgnoreCase(GeoJsonField.COORDINATES)) { jp.nextToken(); // START_ARRAY [ to parse the coordinate parseCoordinateMetadata(jp); } else { throw new SQLException("Malformed GeoJSON file. Expected 'coordinates', found '" + coordinatesField + "'"); } }