GeoJSON (Geographic JavaScript Object Notation) Reader/Writer

Licensing options for this format begin with FME Desktop Professional Edition.

GeoJSON is a standard for encoding spatial data in JSON structured text. FME currently supports the GeoJSON Format Specification Revision 1.0, which is available at http://geojson.org.

Overview

GeoJSON encodes both geometry and feature information into objects. It also provides support for geometry and feature collections.

GeoJSON represents geometry with a single JSON object.

The type of geometry is identified by the value of the type key, which must be present in a GeoJSON object. Possible values of the type key are Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon. The geometry coordinates are stored in the coordinates key of the geometry object.

 

An aggregate geometry is represented by a GeoJSON object which has a type key with value GeometryCollection.

A GeometryCollection object must contain a geometries key whose value is an array containing GeoJSON geometry objects.

 

A feature is represented by a GeoJSON object which has a type key with value Feature.

A Feature object may contain a geometry key whose value is a GeoJSON geometry object or a GeoJSON GeometryCollection object. A Feature object may also contain a properties key whose value is an object containing attribute names and values.

 

A collection of features is represented by a GeoJSON object which has a type key with value FeatureCollection.

A FeatureCollection must contain a features key whose value is any array containing GeoJSON Feature objects.

 

Coordinate systems are supported in GeoJSON through the use of a crs key.

If a GeoJSON object has the crs key, it is assumed to represent the coordinate reference system of the included features or geometries. The value of the crs key must be an object containing both a type and a properties key. If the crs key is absent, the projection is assumed to be LL84. If the type key is set to ‘name’ , then the feature(s) will be tagged with an OGC CRS URN. If the type key is set to ‘link’, it means that the href key is specified as an URL or a file path that contains the CRS info. In this case, the href parameter will be stored in the json_crs_url attribute, with its corresponding type in the json_crs_url_type attribute.

Reader Overview

The GeoJSON reader is capable of reading several different GeoJSON structures. If the base JSON element is a GeoJSON geometry object, then the reader will return a single FME feature with the given geometry. If the base JSON element is a GeoJSON GeometryCollection object, then the reader returns a single FME feature with an aggregate geometry. In both cases, the FME feature type will be GeoJSON.

If the base JSON element is a GeoJSON Feature object, then the GeoJSON reader will return a single FME feature. The feature geometry will be taken from the geometry key of the Feature object, and the feature attributes will be taken from the properties key of the Feature object. If the base JSON element is a GeoJSON FeatureCollection object, then the GeoJSON reader will return an FME feature for each element of the features array of the FeatureCollection object. In both cases, the FME feature type for each feature will be GeoJSON.

If the base JSON element is an array, then any GeoJSON objects in the array are converted into FME features as described above.

If the base JSON element is an object, but not a GeoJSON object, then any value which is a GeoJSON object is converted into FME features as described above, with the exception that the FME feature type is the key name of the corresponding GeoJSON object.

Writer Overview

The GeoJSON writer writes out a single object, in which each key is an FME feature type, and the value of each key is a GeoJSON FeatureCollection object which contains the features of the given type.