Package org.locationtech.spatial4j.io
Class GeoJSONReader
java.lang.Object
org.locationtech.spatial4j.io.GeoJSONReader
- All Implemented Interfaces:
ShapeIO
,ShapeReader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
protected static final String
protected final SpatialContext
protected final ShapeFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Shape
Read aShape
from the reader.protected Circle
readCircle
(org.noggit.JSONParser parser) protected void
readCoordListXYZ
(org.noggit.JSONParser parser, ShapeFactory.PointsBuilder pointsBuilder) protected void
readCoordXYZ
(org.noggit.JSONParser parser, ShapeFactory.PointsBuilder pointsBuilder) protected double
readDistance
(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 Shape
readLineString
(org.noggit.JSONParser parser) protected Shape
readMultiLineString
(org.noggit.JSONParser parser) protected Shape
readMultiPoint
(org.noggit.JSONParser parser) protected Shape
readMultiPolygon
(org.noggit.JSONParser parser) protected Shape
readPoint
(org.noggit.JSONParser parser) protected ShapeFactory.PolygonBuilder
readPolygon
(org.noggit.JSONParser parser, ShapeFactory.PolygonBuilder polygonBuilder) protected Shape
readShape
(org.noggit.JSONParser parser) protected Shape
readShapeFromCoordinates
(String type, org.noggit.JSONParser parser) protected void
readUntilEvent
(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:
getFormatName
in interfaceShapeIO
- Returns:
- the format name
-
read
Description copied from interface:ShapeReader
Read aShape
from the reader.- Specified by:
read
in interfaceShapeReader
- Parameters:
reader
- -- the input. Note, it will not be closed by this function- Returns:
- a valid Shape (never null)
- Throws:
IOException
ParseException
-
read
- Specified by:
read
in interfaceShapeReader
- Parameters:
value
- -- the input value, could be a String or other object- Returns:
- a shape valid shape (not null)
- Throws:
IOException
ParseException
InvalidShapeException
-
readIfSupported
- Specified by:
readIfSupported
in 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
InvalidShapeException
when 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:
IOException
ParseException
-
readCoordListXYZ
protected void readCoordListXYZ(org.noggit.JSONParser parser, ShapeFactory.PointsBuilder pointsBuilder) throws IOException, ParseException - Throws:
IOException
ParseException
-
readUntilEvent
- Throws:
IOException
-
readPoint
- Throws:
IOException
ParseException
-
readLineString
- Throws:
IOException
ParseException
-
readCircle
- Throws:
IOException
ParseException
-
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:
IOException
ParseException
-
readShapeFromCoordinates
protected Shape readShapeFromCoordinates(String type, org.noggit.JSONParser parser) throws IOException, ParseException - Throws:
IOException
ParseException
-
readPolygon
protected ShapeFactory.PolygonBuilder readPolygon(org.noggit.JSONParser parser, ShapeFactory.PolygonBuilder polygonBuilder) throws IOException, ParseException - Throws:
IOException
ParseException
-
readMultiPoint
- Throws:
IOException
ParseException
-
readMultiLineString
protected Shape readMultiLineString(org.noggit.JSONParser parser) throws IOException, ParseException - Throws:
IOException
ParseException
-
readMultiPolygon
- Throws:
IOException
ParseException
-