public class GeoJsonWriter extends Object
Geometrys as JSON fragments in GeoJson format.| Modifier and Type | Field and Description |
|---|---|
static String |
EPSG_PREFIX
The prefix for EPSG codes in the
crs property. |
| Constructor and Description |
|---|
GeoJsonWriter()
Constructs a GeoJsonWriter instance.
|
GeoJsonWriter(int decimals)
Constructs a GeoJsonWriter instance specifying the number of decimals to
use when encoding floating point numbers.
|
| Modifier and Type | Method and Description |
|---|---|
void |
setEncodeCRS(boolean isEncodeCRS)
Sets whether the GeoJSON
crs property should
be output. |
String |
write(org.locationtech.jts.geom.Geometry geometry)
Writes a
Geometry in GeoJson format to a String. |
void |
write(org.locationtech.jts.geom.Geometry geometry,
Writer writer)
Writes a
Geometry in GeoJson format into a Writer. |
public static final String EPSG_PREFIX
crs property.public GeoJsonWriter()
public GeoJsonWriter(int decimals)
decimals - the number of decimal places to outputpublic void setEncodeCRS(boolean isEncodeCRS)
crs property should
be output.
The value of the property is taken from geometry SRID.isEncodeCRS - true if the crs property should be outputpublic String write(org.locationtech.jts.geom.Geometry geometry)
Geometry in GeoJson format to a String.geometry - the geometry to writepublic void write(org.locationtech.jts.geom.Geometry geometry,
Writer writer)
throws IOException
Geometry in GeoJson format into a Writer.geometry - Geometry to encodewriter - Stream to encode to.IOException - throws an IOException when unable to write the JSON stringCopyright © 2021. All rights reserved.