java.lang.Object
org.apache.lucene.geo.SimpleGeoJSONPolygonParser
Does minimal parsing of a GeoJSON object, to extract either Polygon or MultiPolygon, either
directly as the top-level type, or if the top-level type is Feature, as the geometry of that
feature.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanisJSONWhitespace(char ch) private booleanisValidGeometryPath(String path) Returns true if the object path is a valid location to see a Multi/Polygon geometryprivate ParseExceptionnewParseException(String details) When calling this, upto should be at the position of the incorrect character!Polygon[]parse()parseArray(String path) private Numberprivate voidparseObject(String path) path is the "address" by keys of where we are, e.g.private double[][]parsePoints(List<Object> o) Parses [[lat, lon], [lat, lon] ...] into 2d double arrayprivate PolygonparsePolygon(List<Object> coordinates) private Stringprivate charpeek()private voidreadEnd()private voidscan(char expected) Scans across whitespace and consumes the expected character, or throwsParseExceptionif the character is wrongprivate voidScans the expected string, or throwsParseException
-
Field Details
-
input
-
upto
private int upto -
polyType
-
coordinates
-
-
Constructor Details
-
SimpleGeoJSONPolygonParser
-
-
Method Details
-
parse
- Throws:
ParseException
-
parseObject
path is the "address" by keys of where we are, e.g. geometry.coordinates- Throws:
ParseException
-
isValidGeometryPath
Returns true if the object path is a valid location to see a Multi/Polygon geometry -
parsePolygon
- Throws:
ParseException
-
parsePoints
Parses [[lat, lon], [lat, lon] ...] into 2d double array- Throws:
ParseException
-
parseArray
- Throws:
ParseException
-
parseNumber
- Throws:
ParseException
-
parseString
- Throws:
ParseException
-
peek
- Throws:
ParseException
-
scan
Scans across whitespace and consumes the expected character, or throwsParseExceptionif the character is wrong- Throws:
ParseException
-
readEnd
- Throws:
ParseException
-
scan
Scans the expected string, or throwsParseException- Throws:
ParseException
-
isJSONWhitespace
private static boolean isJSONWhitespace(char ch) -
newParseException
When calling this, upto should be at the position of the incorrect character!- Throws:
ParseException
-