Package org.locationtech.spatial4j.io
Class GeoJSONWriter
java.lang.Object
org.locationtech.spatial4j.io.GeoJSONWriter
- All Implemented Interfaces:
ShapeIO
,ShapeWriter
- Direct Known Subclasses:
JtsGeoJSONWriter
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionWrite a shape to Stringprotected void
write
(Writer output, NumberFormat nf, double... coords) void
Write a shape to the output writer(package private) void
writeDistance
(Writer output, NumberFormat nf, double dist, boolean isGeo, String distProperty, String distUnitsProperty) Helper method to encode a distance property (with optional unit).
-
Constructor Details
-
GeoJSONWriter
-
-
Method Details
-
getFormatName
- Specified by:
getFormatName
in interfaceShapeIO
- Returns:
- the format name
-
write
- Throws:
IOException
-
write
Description copied from interface:ShapeWriter
Write a shape to the output writer- Specified by:
write
in interfaceShapeWriter
- Throws:
IOException
-
writeDistance
void writeDistance(Writer output, NumberFormat nf, double dist, boolean isGeo, String distProperty, String distUnitsProperty) throws IOException Helper method to encode a distance property (with optional unit).The distance unit is only encoded when isGeo is true, and it is converted to km.
The distance unit is encoded within a properties object.
- Parameters:
output
- The writer.nf
- The number format.dist
- The distance value to encode.isGeo
- The flag determiningdistProperty
- The distance property name.distUnitsProperty
- The distance unit property name.- Throws:
IOException
-
toString
Description copied from interface:ShapeWriter
Write a shape to String- Specified by:
toString
in interfaceShapeWriter
-