block by nitaku 6982528

TopoJSON geometrical renderer

Full Screen

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.

index.js

index.html

data.dbf

data.json

data.shp

data.shx

data.topo.json

index.coffee

index.css

index.sass