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 boolean
isJSONWhitespace
(char ch) private boolean
isValidGeometryPath
(String path) Returns true if the object path is a valid location to see a Multi/Polygon geometryprivate ParseException
newParseException
(String details) When calling this, upto should be at the position of the incorrect character!Polygon[]
parse()
parseArray
(String path) private Number
private void
parseObject
(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 Polygon
parsePolygon
(List<Object> coordinates) private String
private char
peek()
private void
readEnd()
private void
scan
(char expected) Scans across whitespace and consumes the expected character, or throwsParseException
if the character is wrongprivate void
Scans 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 throwsParseException
if 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
-