Closed hoogw closed 7 years ago
What Node version are you using? Can you try Node v4+?
C:\jh\other_map_geojson>node -v v0.10.36
Good catch, my node version is too old. now I am update it to
C:\jh\other_map_geojson>node -v v6.9.1
I try: node \jh\other_map_geojson\node_modules\geobuf\bin\json2geobuf \jh\other_map_geojson\Raw_geojson\city_parcels.geojson > \jh\other_map_geojson\Raw_geojson\city_parcels.pbf
It works perfect!!!
Thank you so much, I stuck 8 hours didn't figure out it is version problem.
I use windows. in command line window, I type:
node \jh\other_map_geojson\node_modules\geobuf\bin\json2geobuf city_zoning.geojson > city_zoning.pbf
I got a 0 size pbf file. the error is:
C:\jh\other_map_geojson\Raw_geojson\CostaMesa>node \jh\other_map_geojson\node_mo dules\geobuf\bin\json2geobuf city_zoning.geojson > city_zoning.pbf
C:\jh\other_map_geojson\node_modules\geobuf\bin\json2geobuf:20 var buffer = Buffer.from(encode(geojson, new Pbf())); ^ TypeError: Object function Buffer(subject, encoding, offset) { if (!(this instanceof Buffer)) { return new Buffer(subject, encoding, offset); }
var type;
// Are we slicing? if (typeof offset === 'number') { if (!Buffer.isBuffer(subject)) { throw new TypeError('First argument must be a Buffer when slicing'); }
} else { // Find the length switch (type = typeof subject) { case 'number': this.length = +subject > 0 ? Math.ceil(subject) : 0; break;
}
SlowBuffer.makeFastBuffer(this.parent, this, this.offset, this.length); } has no method 'from' at C:\jh\other_map_geojson\node_modules\geobuf\bin\json2geobuf:20:25 at ConcatStream. (C:\jh\other_map_geojson\node_modules\geobuf\nod
e_modules\concat-stream\index.js:36:43)
at ConcatStream.emit (events.js:117:20)
at finishMaybe (C:\jh\other_map_geojson\node_modules\geobuf\node_modules\con
cat-stream\node_modules\readable-stream\lib_stream_writable.js:475:14)
at endWritable (C:\jh\other_map_geojson\node_modules\geobuf\node_modules\con
cat-stream\node_modules\readable-stream\lib_stream_writable.js:485:3)
at ConcatStream.Writable.end (C:\jh\other_map_geojson\node_modules\geobuf\no
de_modules\concat-stream\node_modules\readable-stream\lib_stream_writable.js:45
5:41)
at ReadStream.onend (_stream_readable.js:502:10)
at ReadStream.g (events.js:180:16)
at ReadStream.emit (events.js:117:20)
at _stream_readable.js:944:16