What is difference ...
 
Notifications
Clear all

What is difference between GeoJSON and TopoJSON>|?

1 Posts
1 Users
0 Likes
885 Views
visitgis
Posts: 7
Admin
Topic starter
(@visitgis)
Member
Joined: 3 years ago

If you care about file size or topology, then use TopoJSON. If you don’t care about either, then use GeoJSON for simplicity’s sake.

The primary advantage of TopoJSON is size. By eliminating redundancy and using a more efficent fixed-precision integer encoding of coordinates, TopoJSON files are often an order of magnitude smaller than GeoJSON files. The secondary advantage of TopoJSON files is that encoding the topology has useful applications, such as topology-preserving simplification (similar to MapShaper) and automatic mesh generation (as in the state-state boundaries in this example choropleth).

These advantages come at a cost: a more complex file format. In JavaScript, for example, you’d typically use the TopoJSON client library to convert TopoJSON to GeoJSON for use with standard tools such as d3.geoPath. (In Python, you can use topojson.py.) Also, TopoJSON’s integer format requires quantizing coordinates, which means that it can introduce rounding error if you’re not careful. (See the documentation for topojson -q.)

For server-side manipulation of geometries that does not require topology, then GeoJSON is probably the simpler choice. Otherwise, if you need topology or want to send the geometry over the wire to a client, then use TopoJSON.

Topic Tags
Share: