TopoJSON is an extension of GeoJSON that encodes
topology. Rather than representing geometries discretely, geometries in TopoJSON files are stitched together from shared line segments called
arcs.
Arcs are sequences of points, while line strings and polygons are defined as sequences of arcs. Each arc is defined only once, but can be referenced several times by different shapes, thus reducing redundancy and decreasing the file size. In addition, TopoJSON facilitates applications that use topology, such as topology-preserving shape simplification, automatic map coloring, and
cartograms. A reference implementation of the TopoJSON specification is available as a command-line tool to encode TopoJSON from GeoJSON (or ESRI Shapefiles) and a
client side JavaScript library to decode TopoJSON back to GeoJSON again. TopoJSON is also supported by the popular OGR tool as of version 1.11 and PostGIS as of version 2.1.0.
TopoJSON Schema Given a
GIS shape near
coordinates latitude 0° and
longitude 0°, a simple but valid and complete topojson file containing all metadata,
Polygon,
LineString,
Point elements,
arcs and
properties is defined as follows: { "type":"Topology", "transform":{ "scale": [1,1], "translate": [0,0] }, "objects":{ "two-squares":{ "type": "GeometryCollection", "geometries":[ {"type": "Polygon", "arcs":
0,1,"properties": {"name": "Left_Polygon" }}, {"type": "Polygon", "arcs":
2,-1,"properties": {"name": "Right_Polygon" }} ] }, "one-line": { "type":"GeometryCollection", "geometries":[ {"type": "LineString", "arcs": [3],"properties":{"name":"Under_LineString"}} ] }, "two-places":{ "type":"GeometryCollection", "geometries":[ {"type":"Point","coordinates":[0,0],"properties":{"name":"Origine_Point"}}, {"type":"Point","coordinates":[0,-1],"properties":{"name":"Under_Point"}} ] } }, "arcs": [ 1,2],[0,-2, 1,0],[-1,0],[0,2],[1,0, 1,2],[1,0],[0,-2],[-1,0, 0,-1],[2,0 ] } == See also ==