public class

GeoJSONGeometryReader

extends Object
java.lang.Object
   ↳ com.carto.geometry.GeoJSONGeometryReader

Class Overview

A GeoJSON parser.
Parser supports Geometry, Feature and FeatureCollection inputs.

Summary

Public Constructors
GeoJSONGeometryReader()
Constructs a new GeoJSONGeometryReader object.
Public Methods
synchronized void delete()
Projection getTargetProjection()
Returns the current target projection.
Feature readFeature(String geoJSON)
Reads feature from the specified GeoJSON string.
FeatureCollection readFeatureCollection(String geoJSON)
Reads feature collection from the specified GeoJSON string.
Geometry readGeometry(String geoJSON)
Reads geometry from the specified GeoJSON string.
void setTargetProjection(Projection proj)
Sets the current target projection.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public GeoJSONGeometryReader ()

Constructs a new GeoJSONGeometryReader object.

Public Methods

public synchronized void delete ()

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.

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.

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.

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.

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.