Friday 21 April 2017

Converting shapefiles and geoJson to TopoJson and/or using geo2topo

I'm a complete newb to Node.js. I have not been able to use TopoJson to convert my geoJson file to TopoJson format. I have topojson v3.0.0

I've written a test.js file that I'm executing with node.exe.

It's like the following:

var tjson = require("topojson")

tjson.topojson -p --no-stitch-poles -o zip3.topo.json -- zip3.geo.json

console.log("hello")

It complains about the no-stitch parameter. But I tried a lot of things and now I suspect I'm missing something huge. I looked over the github and now I am fairly sure that the process to convert geo to topo changed at some point. Like maybe he split out the functionality to subsections? I'm not sure.

Any help for a node newbie?

I started very confused about whether to launch things from the cmd prompt, within node, or to create a js file and launch that file with node. I still don't know to do. I got the best results by creating a js file and launching that js with node.exe. But I still seem to be missing something.

I tried console.log(tjson) and that showed me the list of functions for topojson. But I don't know how to launch those functions. I have tried to follow some tutorials for node but they dont seem to apply to TopoJson.

Thanks for the great tool and your help in advance.

I've always looked at his tutorial on using geo2topo.
https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c

https://medium.com/@mbostock/command-line-cartography-part-3-1158e4c55a1e

I get geo2topo is undefined. I can only guess that the tutorial is making some kind of assumption that I know what environment to run these commands in and from what folder.



via Neo42

No comments:

Post a Comment