TopoJSON (Topology JavaScript Object Notation) Reader/Writer

FME can read and write data in the TopoJSON (Topology JavaScript Object Notation) format.

TopoJson is an extension to GeoJSON that utilizes topology. Like the GeoJSON (Geographic JavaScript Object Notation) Reader/Writer, spatial data in JSON is identified using key/value pairs. However, unlike GeoJSON, TopoJSON reduces redundancies for related geometries by representing overlapping edges without duplication. This limitation makes GeoJSON less suitable than TopoJSON for applications that focuses on efficiency and compactness. The paragraph below gives an overview of TopoJSON syntax. For detailed information about the TopoJSON format, see the TopoJSON Format Specification on GitHub.

TopoJSON Product and System Requirements

Format

FME Platform

Operating System

Reader/Writer

FME Form

FME Flow

FME Flow Hosted

Windows 64-bit

Linux

Mac

Reader

Yes

Yes

Yes

Yes

Yes

Yes

Writer

Yes

Yes

Yes

Yes

Yes

Yes

Overview

TopoJSON represents geometries as a collection of shared line segments called arcs, as referenced by zero-based index. This allows for reduction in redundancies mentioned above.

Similar to GeoJSON, the supported geometry types are Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon.

Geometry Example

{"type": "LineString", "arcs": [2]}

where 2 refers to the arc topology.arcs[2].

In addition, TopoJSON uses quantized delta-encoding for integer coordinates. See

https://github.com/topojson/topojson-specification#225-polygon for an example.

Reader Overview

The TopoJSON reader can read a json file with the top-level object of type “Topology”.

Inside the top-level object, there must be an array of “arcs” and an object of value objects, as well as an optional object of value transform. There can be one or more object inside the objects object: each object will be read as distinct feature types.

These distinct feature types may share references to the same arcs array and the transform object within the same file.

Writer Overview

Each FME feature type will output a new file containing the topology JSON object, or each FME feature type can be written together in a single file, with values separated by feature type. This is dependent on the Write to parameter, which can either be set to write to Multiple Files or One File.

Writer Geometry

FME feature geometry written inside a TopoJSON geometry's object will have the type of geometry as the value of the type keyword. TopoJSON is an extension of GeoJSON, thus the TopoJSON writer only supports linear geometry: arcs will be stroked to lines, and ellipses will be stroked to polygons. Also, paths are simplified to a single line, and an FME feature with text geometry only has its location written; the text value is ignored.

The value of the type key for an FME feature with aggregate geometry will be a GeometryCollection object, whose geometries key will have an array of TopoJSON geometry as its value.