سؤال

Topojson-svg trial: I gave it a shoot...

curl -o uk.topo.json 'http://bost.ocks.org/mike/map/uk.json' #get an online topoJSON file
topojson-svg -o output.svg uk.topo.json    #works !

But the uk.json => output.svg result is a #000000FF version of this :

wikiatlas_topojson-svg

which is UK, right, but with strange circles and inverted uk.

هل كانت مفيدة؟

المحلول

Based on Jason davies' answer.

The problem is that you’re converting unprojected TopoJSON (geographic coordinates) to SVG.

You need the lastest topojson code :

 sudo npm rm -g topojson
 sudo npm install -g topojson
 topojson --version

Should return +1.6.12.

You’ll want to pre-project uk.json first, using topojson. Then, convert the projected TopoJSON to SVG using topojson-svg.

curl -o uk.topo.json 'http://bost.ocks.org/mike/map/uk.json' #get an online topoJSON file
topojson uk.topo.json --projection='d3.geo.mercator()' -o out.topo.json #works !
topojson-svg -o output.svg out.topo.json    #works !

Produce that :

wikiatlas_topojson-svg_reprojected_subunits labels

The uk.topojson containing 2 layers merged from 2 different topoJSON, large circles are causes by the object-places layer. But the country shapes are doing well.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top