Class GeoJsonWriter


  • public class GeoJsonWriter
    extends java.lang.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 java.lang.String EPSG_PREFIX  
    • Constructor Summary

      Constructors 
      Constructor Description
      GeoJsonWriter()
      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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setEncodeCRS​(boolean isEncodeCRS)  
      java.lang.String write​(Geometry geometry)
      Writes a Geometry in GeoJson format to a String.
      void write​(Geometry geometry, java.io.Writer writer)
      Writes a Geometry in GeoJson format into a Writer.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • setEncodeCRS

        public void setEncodeCRS​(boolean isEncodeCRS)
      • write

        public java.lang.String write​(Geometry geometry)
        Writes a Geometry in GeoJson format to a String.
        Parameters:
        geometry -
        Returns:
        String GeoJson Encoded Geometry
      • write

        public void write​(Geometry geometry,
                          java.io.Writer writer)
                   throws java.io.IOException
        Writes a Geometry in GeoJson format into a Writer.
        Parameters:
        geometry - Geometry to encode
        writer - Stream to encode to.
        Throws:
        java.io.IOException - throws an IOException when unable to write the JSON string