An example of TopoJSON rendering for geometrical (non-geographical) features with integer coordinates.
The data files have been produced with OpenJUMP and saved in ESRI's Shapefile format, then converted with ogr2ogr into GeoJSON, then converted for a last time in TopoJSON with topojson
, using some parameters that deal with integer coordinates:
ogr2ogr -f geoJSON data.json data.shp
topojson --cartesian --no-quantization -p a -p b -o data.topo.json data.json
The file is then loaded into D3.js, rendered with a custom projection that only performs a scale and a translation, and styled according to two example properties: a
(categorical) and b
(quantitative).
See Mike Bostock's tutorial on TopoJSON for a general introduction.
Modified http://d3js.org/d3.v3.min.js to a secure url
Modified http://d3js.org/topojson.v1.min.js to a secure url
https://d3js.org/d3.v3.min.js
https://d3js.org/topojson.v1.min.js