The difference between GeoJSON and TopoJSON

What is the difference between GeoJSON and TopoJSON and when will I use one over the other?

The description of TopoJSON on GitHub means that TopoJSON files are 80% smaller. Why not just use TopoJSON all the time?

+58
gis topojson geojson
Feb 06 '13 at 23:14
source share
3 answers

If you need file size or topology, use TopoJSON. If you don't care about this, use GeoJSON for simplicity.

The main advantage of TopoJSON is its size. Eliminating redundancy and using more efficient integer coordinate coding with fixed precision, TopoJSON files are often an order of magnitude smaller than GeoJSON files. The second advantage of TopoJSON files is that topology coding has useful applications, such as simplification of topology simplification (similar to MapShaper ) and automatic meshing (as in state-state bounds in this choropleth example ).

These benefits bring value: a more complex file format. In JavaScript, for example, youd typically uses the TopoJSON client library to convert TopoJSON to GeoJSON for use with standard tools like d3.geoPath . (In Python, you can use topojson.py . Also, the integer TopoJSON format requires coordinate quantization, which means that it can introduce a rounding error if you're not careful. (See the documentation for topojson -q .)

For server-side processing of geometries that do not require topology, GeoJSON is probably an easier choice. Otherwise, if you need a topology or you want to send geometry by wire to a client, use TopoJSON.

+106
Feb 08 '13 at 3:41
source share

TopoJSON is ideal for neat features that are β€œtied” to each other, such as administrative areas, but do not help with more dirty or organic data. If your data is just dots, then TopoJSON doesn't help at all.

+8
Feb 07 '13 at 5:57
source share

It depends on many considerations. Among them are the following:

1) The nature (data model) of the function or functions that you would like to represent 2) Any attributes that you would like to associate with these functions 3) How do you want these functions to be displayed on the page (static or dynamic)

However, this is a complex question that must be answered abstractly. As for some features, if you have continuous coverage of the polygon or another situation where functions share borders, the topojson model allows you to use the redundancy and coefficient that is in the model.

Read the documentation, analyze the examples (for example, bl.ocks.org), and then get some data and present it both in the geo-zone and in the topographic and create your own visualizations.

+3
Feb 07 '13 at 14:52
source share



All Articles