public class GeoJsonReader extends Object
Geometry.
A specification of the GeoJson format can be found at the GeoJson web site: http://geojson.org/geojson-spec.html.
It is the caller's responsibility to ensure that the supplied
PrecisionModel matches the precision of the incoming data. If a lower
precision for the data is required, a subsequent process must be run on the
data to reduce its precision.
| Constructor and Description |
|---|
GeoJsonReader()
The default constructor uses the SRID from the Geojson CRS and the
default
PrecisionModel to create a
GeometryFactory. |
GeoJsonReader(org.locationtech.jts.geom.GeometryFactory geometryFactory)
This constructor accepts a
GeometryFactory that is used
to create the output geometries and to override the GeoJson CRS. |
| Modifier and Type | Method and Description |
|---|---|
org.locationtech.jts.geom.Geometry |
read(Reader reader)
Reads a GeoJson Geometry from a
Reader into a single
Geometry. |
org.locationtech.jts.geom.Geometry |
read(String json)
Reads a GeoJson Geometry from a String into a single
Geometry. |
public GeoJsonReader()
PrecisionModel to create a
GeometryFactory. If there is no CRS specified then the default
CRS is a geographic coordinate reference system, using the WGS84 datum, and
with longitude and latitude units of decimal degrees (SRID = 4326)public GeoJsonReader(org.locationtech.jts.geom.GeometryFactory geometryFactory)
GeometryFactory that is used
to create the output geometries and to override the GeoJson CRS.geometryFactory - a GeometryFactorypublic org.locationtech.jts.geom.Geometry read(String json) throws org.locationtech.jts.io.ParseException
Geometry.json - The GeoJson String to parseorg.locationtech.jts.io.ParseException - throws a ParseException if the JSON string cannot be parsedpublic org.locationtech.jts.geom.Geometry read(Reader reader) throws org.locationtech.jts.io.ParseException
Reader into a single
Geometry.reader - The input sourceorg.locationtech.jts.io.ParseException - throws a ParseException if the JSON string cannot be parsedCopyright © 2019. All rights reserved.