Package org.locationtech.jts.io.geojson
Class GeoJsonWriter
java.lang.Object
org.locationtech.jts.io.geojson.GeoJsonWriter
Writes
Geometrys as JSON fragments in GeoJson format.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a GeoJsonWriter instance.GeoJsonWriter(int decimals) Constructs a GeoJsonWriter instance specifying the number of decimals to use when encoding floating point numbers. -
Method Summary
Modifier and TypeMethodDescriptioncreateCRS(int srid) private StringformatOrdinate(double x) private StringgetJsonString(CoordinateSequence coordinateSequence) makeJsonAware(GeometryCollection geometryCollection) private List<org.json.simple.JSONAware> makeJsonAware(Polygon poly) voidsetEncodeCRS(boolean isEncodeCRS) Writes aGeometryin GeoJson format to a String.void
-
Field Details
-
EPSG_PREFIX
- See Also:
-
scale
private double scale -
isEncodeCRS
private boolean isEncodeCRS
-
-
Constructor Details
-
GeoJsonWriter
public GeoJsonWriter()Constructs a GeoJsonWriter instance. -
GeoJsonWriter
public GeoJsonWriter(int decimals) Constructs a GeoJsonWriter instance specifying the number of decimals to use when encoding floating point numbers.
-
-
Method Details
-
setEncodeCRS
public void setEncodeCRS(boolean isEncodeCRS) -
write
Writes aGeometryin GeoJson format to a String.- Parameters:
geometry-- Returns:
- String GeoJson Encoded Geometry
-
write
- Parameters:
geometry- Geometry to encodewriter- Stream to encode to.- Throws:
IOException- throws an IOException when unable to write the JSON string
-
create
-
createCRS
-
makeJsonAware
-
makeJsonAware
-
getJsonString
-
formatOrdinate
-