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 ShapeIOpublic final Shape read(Reader reader) throws IOException, ParseException
ShapeReaderShape from the reader.read in interface ShapeReaderreader - -- the input. Note, it will not be closed by this functionIOExceptionParseExceptionpublic Shape read(Object value) throws IOException, ParseException, InvalidShapeException
read in interface ShapeReadervalue - -- the input value, could be a String or other objectIOExceptionParseExceptionInvalidShapeExceptionpublic Shape readIfSupported(Object value) throws InvalidShapeException
readIfSupported in interface ShapeReadervalue - -- the input value, could be a String or other objectInvalidShapeException when we could read a shape, but it was
invalidInvalidShapeExceptionpublic List<?> readCoordinates(org.noggit.JSONParser parser) throws IOException, ParseException
IOExceptionParseExceptionpublic double[] readCoordXY(org.noggit.JSONParser parser)
throws IOException,
ParseException
IOExceptionParseExceptionpublic List<double[]> readCoordListXY(org.noggit.JSONParser parser) throws IOException, ParseException
IOExceptionParseExceptionprotected void readUntilEvent(org.noggit.JSONParser parser,
int event)
throws IOException
IOExceptionprotected Shape readPoint(org.noggit.JSONParser parser) throws IOException, ParseException
IOExceptionParseExceptionprotected Shape readLineString(org.noggit.JSONParser parser) throws IOException, ParseException
IOExceptionParseExceptionprotected Circle readCircle(org.noggit.JSONParser parser) throws IOException, ParseException
IOExceptionParseExceptionprotected 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.IOExceptionprotected 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 canParseExceptionIOExceptionpublic Shape readShape(org.noggit.JSONParser parser) throws IOException, ParseException
IOExceptionParseExceptionCopyright © 2025. All rights reserved.