Class GeoJsonWriter

java.lang.Object
org.gvsig.fmap.geom.jts.formats.geojson.GeoJsonWriter
Direct Known Subclasses:
GeoJsonWriterEx

public class GeoJsonWriter extends Object
Writes Geometrys as JSON fragments in GeoJson format.
Author:
Martin Davis, Paul Howells, Vivid Solutions
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    protected boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs 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 Type
    Method
    Description
    protected Map<String,Object>
    create(com.vividsolutions.jts.geom.Geometry geometry, boolean encodeCRS)
     
    void
    setEncodeCRS(boolean isEncodeCRS)
     
    write(com.vividsolutions.jts.geom.Geometry geometry)
    Writes a Geometry in GeoJson format to a String.
    void
    write(com.vividsolutions.jts.geom.Geometry geometry, Writer writer)
    Writes a Geometry in GeoJson format into a Writer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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

      public String write(com.vividsolutions.jts.geom.Geometry geometry)
      Writes a Geometry in GeoJson format to a String.
      Parameters:
      geometry -
      Returns:
      String GeoJson Encoded Geometry
    • write

      public void write(com.vividsolutions.jts.geom.Geometry geometry, Writer writer) throws IOException
      Writes a Geometry in GeoJson format into a Writer.
      Parameters:
      geometry - Geometry to encode
      writer - Stream to encode to.
      Throws:
      IOException - throws an IOException when unable to write the JSON string
    • create

      protected Map<String,Object> create(com.vividsolutions.jts.geom.Geometry geometry, boolean encodeCRS)