Class GeoJSONReader
java.lang.Object
org.locationtech.spatial4j.io.GeoJSONReader
- All Implemented Interfaces:
ShapeIO, ShapeReader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected final SpatialContextprotected final ShapeFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ShapeRead aShapefrom the reader.protected CirclereadCircle(org.noggit.JSONParser parser) protected voidreadCoordListXYZ(org.noggit.JSONParser parser, ShapeFactory.PointsBuilder pointsBuilder) protected voidreadCoordXYZ(org.noggit.JSONParser parser, ShapeFactory.PointsBuilder pointsBuilder) protected doublereadDistance(String distProperty, String distUnitsProperty, org.noggit.JSONParser parser) Helper method to read a up until a distance value (radius, buffer) and it's corresponding unit are found.readIfSupported(Object value) protected ShapereadLineString(org.noggit.JSONParser parser) protected ShapereadMultiLineString(org.noggit.JSONParser parser) protected ShapereadMultiPoint(org.noggit.JSONParser parser) protected ShapereadMultiPolygon(org.noggit.JSONParser parser) protected ShapereadPoint(org.noggit.JSONParser parser) protected ShapeFactory.PolygonBuilderreadPolygon(org.noggit.JSONParser parser, ShapeFactory.PolygonBuilder polygonBuilder) protected ShapereadShape(org.noggit.JSONParser parser) protected ShapereadShapeFromCoordinates(String type, org.noggit.JSONParser parser) protected voidreadUntilEvent(org.noggit.JSONParser parser, int event)
-
Field Details
-
BUFFER
- See Also:
-
BUFFER_UNITS
- See Also:
-
ctx
-
shapeFactory
-
-
Constructor Details
-
GeoJSONReader
-
-
Method Details
-
getFormatName
- Specified by:
getFormatNamein interfaceShapeIO- Returns:
- the format name
-
read
Description copied from interface:ShapeReaderRead aShapefrom the reader.- Specified by:
readin interfaceShapeReader- Parameters:
reader- -- the input. Note, it will not be closed by this function- Returns:
- a valid Shape (never null)
- Throws:
IOExceptionParseException
-
read
- Specified by:
readin interfaceShapeReader- Parameters:
value- -- the input value, could be a String or other object- Returns:
- a shape valid shape (not null)
- Throws:
IOExceptionParseExceptionInvalidShapeException
-
readIfSupported
- Specified by:
readIfSupportedin interfaceShapeReader- Parameters:
value- -- the input value, could be a String or other object- Returns:
- a shape or null, if the input was un readable.
This will throw
InvalidShapeExceptionwhen we could read a shape, but it was invalid - Throws:
InvalidShapeException
-
readCoordXYZ
protected void readCoordXYZ(org.noggit.JSONParser parser, ShapeFactory.PointsBuilder pointsBuilder) throws IOException, ParseException - Throws:
IOExceptionParseException
-
readCoordListXYZ
protected void readCoordListXYZ(org.noggit.JSONParser parser, ShapeFactory.PointsBuilder pointsBuilder) throws IOException, ParseException - Throws:
IOExceptionParseException
-
readUntilEvent
- Throws:
IOException
-
readPoint
- Throws:
IOExceptionParseException
-
readLineString
- Throws:
IOExceptionParseException
-
readCircle
- Throws:
IOExceptionParseException
-
readDistance
protected double readDistance(String distProperty, String distUnitsProperty, org.noggit.JSONParser parser) throws IOException Helper method to read a up until a distance value (radius, buffer) and it's corresponding unit are found.This method returns 0 if no distance value is found. This method currently only handles distance units of "km".
- Parameters:
distProperty- The name of the property containing the distance value.distUnitsProperty- The name of the property containing the distance unit.- Throws:
IOException
-
readShape
- Throws:
IOExceptionParseException
-
readShapeFromCoordinates
protected Shape readShapeFromCoordinates(String type, org.noggit.JSONParser parser) throws IOException, ParseException - Throws:
IOExceptionParseException
-
readPolygon
protected ShapeFactory.PolygonBuilder readPolygon(org.noggit.JSONParser parser, ShapeFactory.PolygonBuilder polygonBuilder) throws IOException, ParseException - Throws:
IOExceptionParseException
-
readMultiPoint
- Throws:
IOExceptionParseException
-
readMultiLineString
protected Shape readMultiLineString(org.noggit.JSONParser parser) throws IOException, ParseException - Throws:
IOExceptionParseException
-
readMultiPolygon
- Throws:
IOExceptionParseException
-