How can GeoJSON data to TopoJSON be converted?
TopoJSON files are often smaller than GeoJSON and the conversion allows you to incrementally simplify a dataset, if you wish.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityGlad you asked, oh handsome OP.
topojson
From the command line (Mac OSX 10.8, assumes homebrew installed):
brew install node.js
npm install -g topojson
topojson -o output.json input.json
The function to create a topojson from a geojson in topojson has been moved to geo2topo
npm install topojson-server -g
geo2topo input.geojson > output.topojson
not recognized
error when trying to run geo2topo
after running npm install topojson-server
– JoeBe
Jan 31 '20 at 2:34
I ported the TopoJSON code from JavaScript to Python, following the exact same format Mike uses in his library (along with his +300 tests).
If you feel better with Python, just install the library by running:
pip install pytopojson
And then run:
python geo2topo.py geojson_file
You can also use a quantization parameter. Just use the -h
argument to see how it works.
Let me know if this was helpful to you!
topojson -o output_file.json input_file.json
works for me under 1.1.0 and 1.4.0. Perhaps you can ask a formal question on here with more info on the problem you're having? Cheers! – Jeff Sep 6 '13 at 18:09