Package org.locationtech.spatial4j.io
Class GeoJSONWriter
- java.lang.Object
-
- org.locationtech.spatial4j.io.GeoJSONWriter
-
- All Implemented Interfaces:
ShapeIO,ShapeWriter
- Direct Known Subclasses:
JtsGeoJSONWriter
public class GeoJSONWriter extends java.lang.Object implements ShapeWriter
-
-
Constructor Summary
Constructors Constructor Description GeoJSONWriter(SpatialContext ctx, SpatialContextFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetFormatName()java.lang.StringtoString(Shape shape)Write a shape to Stringprotected voidwrite(java.io.Writer output, java.text.NumberFormat nf, double... coords)voidwrite(java.io.Writer output, Shape shape)Write a shape to the output writer(package private) voidwriteDistance(java.io.Writer output, java.text.NumberFormat nf, double dist, boolean isGeo, java.lang.String distProperty, java.lang.String distUnitsProperty)Helper method to encode a distance property (with optional unit).
-
-
-
Constructor Detail
-
GeoJSONWriter
public GeoJSONWriter(SpatialContext ctx, SpatialContextFactory factory)
-
-
Method Detail
-
getFormatName
public java.lang.String getFormatName()
- Specified by:
getFormatNamein interfaceShapeIO- Returns:
- the format name
-
write
protected void write(java.io.Writer output, java.text.NumberFormat nf, double... coords) throws java.io.IOException- Throws:
java.io.IOException
-
write
public void write(java.io.Writer output, Shape shape) throws java.io.IOExceptionDescription copied from interface:ShapeWriterWrite a shape to the output writer- Specified by:
writein interfaceShapeWriter- Throws:
java.io.IOException
-
writeDistance
void writeDistance(java.io.Writer output, java.text.NumberFormat nf, double dist, boolean isGeo, java.lang.String distProperty, java.lang.String distUnitsProperty) throws java.io.IOExceptionHelper 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:
java.io.IOException
-
toString
public java.lang.String toString(Shape shape)
Description copied from interface:ShapeWriterWrite a shape to String- Specified by:
toStringin interfaceShapeWriter
-
-