public class GeoJSONReader extends Object implements ShapeReader
Modifier and Type | Field and Description |
---|---|
protected static String |
BUFFER |
protected static String |
BUFFER_UNITS |
protected SpatialContext |
ctx |
protected ShapeFactory |
shapeFactory |
Constructor and Description |
---|
GeoJSONReader(SpatialContext ctx,
SpatialContextFactory factory) |
Modifier and Type | Method and Description |
---|---|
String |
getFormatName() |
Shape |
read(Object value) |
Shape |
read(Reader reader)
Read a
Shape 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.
|
Shape |
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) |
protected static final String BUFFER
protected static final String BUFFER_UNITS
protected final SpatialContext ctx
protected final ShapeFactory shapeFactory
public GeoJSONReader(SpatialContext ctx, SpatialContextFactory factory)
public String getFormatName()
getFormatName
in interface ShapeIO
public final Shape read(Reader reader) throws IOException, ParseException
ShapeReader
Shape
from the reader.read
in interface ShapeReader
reader
- -- the input. Note, it will not be closed by this functionIOException
ParseException
public Shape read(Object value) throws IOException, ParseException, InvalidShapeException
read
in interface ShapeReader
value
- -- the input value, could be a String or other objectIOException
ParseException
InvalidShapeException
public Shape readIfSupported(Object value) throws InvalidShapeException
readIfSupported
in interface ShapeReader
value
- -- the input value, could be a String or other objectInvalidShapeException
when we could read a shape, but it was
invalidInvalidShapeException
protected void readCoordXYZ(org.noggit.JSONParser parser, ShapeFactory.PointsBuilder pointsBuilder) throws IOException, ParseException
IOException
ParseException
protected void readCoordListXYZ(org.noggit.JSONParser parser, ShapeFactory.PointsBuilder pointsBuilder) throws IOException, ParseException
IOException
ParseException
protected void readUntilEvent(org.noggit.JSONParser parser, int event) throws IOException
IOException
protected Shape readPoint(org.noggit.JSONParser parser) throws IOException, ParseException
IOException
ParseException
protected Shape readLineString(org.noggit.JSONParser parser) throws IOException, ParseException
IOException
ParseException
protected Circle readCircle(org.noggit.JSONParser parser) throws IOException, ParseException
IOException
ParseException
protected double readDistance(String distProperty, String distUnitsProperty, org.noggit.JSONParser parser) throws IOException
This method returns 0 if no distance value is found. This method currently only handles distance units of "km".
distProperty
- The name of the property containing the distance value.distUnitsProperty
- The name of the property containing the distance unit.IOException
protected Shape readShape(org.noggit.JSONParser parser) throws IOException, ParseException
IOException
ParseException
protected Shape readShapeFromCoordinates(String type, org.noggit.JSONParser parser) throws IOException, ParseException
IOException
ParseException
protected ShapeFactory.PolygonBuilder readPolygon(org.noggit.JSONParser parser, ShapeFactory.PolygonBuilder polygonBuilder) throws IOException, ParseException
IOException
ParseException
protected Shape readMultiPoint(org.noggit.JSONParser parser) throws IOException, ParseException
IOException
ParseException
protected Shape readMultiLineString(org.noggit.JSONParser parser) throws IOException, ParseException
IOException
ParseException
protected Shape readMultiPolygon(org.noggit.JSONParser parser) throws IOException, ParseException
IOException
ParseException
Copyright © 2020 LocationTech. All rights reserved.