Package org.locationtech.jts.io.geojson
Class GeoJsonWriter
java.lang.Object
org.locationtech.jts.io.geojson.GeoJsonWriter
Writes
Geometry
s 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 String
formatOrdinate
(double x) private String
getJsonString
(CoordinateSequence coordinateSequence) makeJsonAware
(GeometryCollection geometryCollection) private List
<org.json.simple.JSONAware> makeJsonAware
(Polygon poly) void
setEncodeCRS
(boolean isEncodeCRS) Writes aGeometry
in 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 aGeometry
in 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
-