Class GeoJSONWriter

java.lang.Object
org.locationtech.spatial4j.io.GeoJSONWriter
All Implemented Interfaces:
ShapeIO, ShapeWriter
Direct Known Subclasses:
JtsGeoJSONWriter

public class GeoJSONWriter extends Object implements ShapeWriter
  • Constructor Details

  • Method Details

    • getFormatName

      public String getFormatName()
      Specified by:
      getFormatName in interface ShapeIO
      Returns:
      the format name
    • write

      protected void write(Writer output, NumberFormat nf, double... coords) throws IOException
      Throws:
      IOException
    • write

      public void write(Writer output, Shape shape) throws IOException
      Description copied from interface: ShapeWriter
      Write a shape to the output writer
      Specified by:
      write in interface ShapeWriter
      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 determining
      distProperty - The distance property name.
      distUnitsProperty - The distance unit property name.
      Throws:
      IOException
    • toString

      public String toString(Shape shape)
      Description copied from interface: ShapeWriter
      Write a shape to String
      Specified by:
      toString in interface ShapeWriter