Class GeoJSONGeometryReader

java.lang.Object
com.massifmaps.geometry.GeoJSONGeometryReader

public class GeoJSONGeometryReader extends Object
A GeoJSON parser.
Parser supports Geometry, Feature and FeatureCollection inputs.
  • Constructor Details

    • GeoJSONGeometryReader

      public GeoJSONGeometryReader()
      Constructs a new GeoJSONGeometryReader object.
  • Method Details

    • getTargetProjection

      public Projection getTargetProjection()
      Returns the current target projection. If target projection is set, all geometry
      coordinates will be converted from WGS84 to target projection coordinate system.
      Returns:
      The current target projection or null.
    • setTargetProjection

      public void setTargetProjection(Projection proj)
      Sets the current target projection. If target projection is set, all geometry
      coordinates will be converted from WGS84 to target projection coordinate system.
      Parameters:
      proj - The new target projection or null.
    • readGeometry

      public Geometry readGeometry(String geoJSON)
      Reads geometry from the specified GeoJSON string.
      Parameters:
      geoJSON - The GeoJSON string to read.
      Returns:
      The geometry read from the string.
      Throws:
      Exception - If string could not be parsed.
    • readFeature

      public Feature readFeature(String geoJSON)
      Reads feature from the specified GeoJSON string.
      Parameters:
      geoJSON - The GeoJSON string to read.
      Returns:
      The feature read from the string.
      Throws:
      Exception - If string could not be parsed.
    • readFeatureCollection

      public FeatureCollection readFeatureCollection(String geoJSON)
      Reads feature collection from the specified GeoJSON string.
      Parameters:
      geoJSON - The GeoJSON string to read.
      Returns:
      The feature collection read from the string.
      Throws:
      Exception - If string could not be parsed.