csv2geojson
csv2geojson copied to clipboard
JavaScript heap out of memory
I'm trying to convert a csv that is 86 mb to geojson using the command line. I installed csv2geojson as a binary. Does anyone know how to fix the following error I'm getting?
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [node]
2: 0x13647ec [node]
3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
5: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [node]
6: v8::internal::IncrementalStringBuilder::Extend() [node]
7: v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_
Looks like editing the csv2geojson.cmd worked for me on Windows to bump up the amount of memory NodeJS is allowed to use
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" --max-old-space-size=8000 "%~dp0\node_modules\csv2geojson\csv2geojson" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node --max-old-space-size=8000 "%~dp0\node_modules\csv2geojson\csv2geojson" %*
)
Thanks @rayterrill, you also do this:
NODE_OPTIONS=--max_old_space_size=4096 csv2geojson ...