public class GeoJSONReader extends Object implements ShapeReader
Modifier and Type | Field and Description |
---|---|
protected static String |
BUFFER |
protected static String |
BUFFER_UNITS |
Constructor and Description |
---|
GeoJSONReader(SpatialContext ctx,
SpatialContextFactory factory) |
Modifier and Type | Method and Description |
---|---|
String |
getFormatName() |
protected Shape |
makeShapeFromCoords(String type,
List coords) |
Shape |
read(Object value) |
Shape |
read(Reader reader)
Read a
Shape from the reader. |
protected Circle |
readCircle(org.noggit.JSONParser parser) |
List<?> |
readCoordinates(org.noggit.JSONParser parser) |
List<double[]> |
readCoordListXY(org.noggit.JSONParser parser) |
double[] |
readCoordXY(org.noggit.JSONParser parser) |
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 |
readPoint(org.noggit.JSONParser parser) |
protected Shape |
readPolygon(org.noggit.JSONParser parser)
This method takes a polygon and makes a bbox from it
NOTE: not currently used! polygon is currently implemented in:
makeShapeFromCoords(String, List)
We could add a 'strict' or 'leinent' mode that would try the best it can |
Shape |
readShape(org.noggit.JSONParser parser) |
protected void |
readUntilEvent(org.noggit.JSONParser parser,
int event) |
protected static final String BUFFER
protected static final String BUFFER_UNITS
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
public List<?> readCoordinates(org.noggit.JSONParser parser) throws IOException, ParseException
IOException
ParseException
public double[] readCoordXY(org.noggit.JSONParser parser) throws IOException, ParseException
IOException
ParseException
public List<double[]> readCoordListXY(org.noggit.JSONParser parser) 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 readPolygon(org.noggit.JSONParser parser) throws IOException, ParseException
makeShapeFromCoords(String, List)
We could add a 'strict' or 'leinent' mode that would try the best it canParseException
IOException
public Shape readShape(org.noggit.JSONParser parser) throws IOException, ParseException
IOException
ParseException
Copyright © 2015. All rights reserved.