Mike Bostock shared a range of world wide topojson files.
As I wanted more data and higher quality, I now generate my own high quality topojson files from Natural Earth. To make it simple, my makefile / command is such:
admin_0: crop
../node_modules/topojson/bin/topojson \
--id-property name \
-p name=name \
-q 1e4 \
--filter=small \
-o admin_0.topo.json \
-- admin_0=./natural_earth_vector/10m_cultural/ne_10m_admin_0_countries.shp
But my 3MB .topojson is crispy, nasty, graphically messy. Take a look at the coastline, you will see the most annoying thing : lines looking like "stairs" : horizontal, vertical, horizontal, vertical,...
On his side, M. Bostock's 90kb .topojson does surprisingly fine in term of elegance. Not perfect, but nice, and he does have diagonals (!) and various angles used by his lines.
I tried reducing the quantization to -q 1e3
, but it keeps crispy, and it's even more ugly: the stair's steps are even bigger.
From the command line API, I noticed and read as much as I could on :
- -q, --quantization, --no-quantization maximum number of differentiable points along either dimension
- -s, --simplify precision threshold for Visvalingam simplification
- --simplify-proportion proportion of points to retain for Visvalingam simplification
- --width scale and translate to fit a viewport of the specified width
- --height scale and translate to fit a viewport of the specified height
which may all help me. I made some test to mainly learn that balancing simplification is tricky. I would like to ask for experienced users how then handle and balance their topojson simplification.
What approach do you take yourself ? and so... What topojson parameters should I use to make my topojson nicer ? (no crispy stairs-steps edge, correct loyalty the the shape)
-q
then doing massive-s
or--simplify-proportion
is good since simplification algorithms add distortions. Needing a final 1200px map, I'am currently going for quantification just above my need together with small simplification, something such-q 1e4 -s <something small>
. – Hugolpz