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 > test.topojson
and also the following command for simplification:
geo2topo test.json > test.topojson -q 10000
Both of them produce the same following error:
buffer.js:503
throw new Error('"toString()" failed');
^
Error: "toString()" failed
at Buffer.toString (buffer.js:503:11)
at JSON.parse ()
at ReadStream. (/usr/local/lib/node_modules/topojson/node_modules/topojson-server/bin/geo2topo:107:46)
at emitNone (events.js:91:20)
at ReadStream.emit (events.js:188:7)
at endReadableNT (_stream_readable.js:975:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
I looked at various threads like this one but haven't found any solutions. Please note that the geojson itself is properly formatted and can be loaded in d3.js, but due to its size cannot be used in web applications.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…