Skip to content Skip to sidebar Skip to footer

Large Geojson To Topojson

I am trying to convert a relatively large geojson file (383 MB) to topojson to use it with D3.js. I am running the following command on a mac book pro 2016: geo2topo test.json >

Solution 1:

Unaware of the actual errors being thrown I do have suggestions:

Maybe you can make use of ndjson? Like ndjson-split 'd.features' < test.json > test.ndjson. That way you could break down your file to smaller parts or get rid of unnecessary features via ndjson-filter.


Solution 2:

I hit the same problem yesterday. Specifically, the v8 engine can't read strings larger than 256Mb. Since the first step of loading the geojson is to read and parse it as a json, that doesn't work.

However, a good soul ported the node implementation to python:

https://github.com/calvinmetcalf/topojson.py

Since python doesn't have that limitation, you can use this code to create the topojson, then do whatever you want with it.


Post a Comment for "Large Geojson To Topojson"