geojson-merge icon indicating copy to clipboard operation
geojson-merge copied to clipboard

CLI streaming mode is broken

Open ykessler opened this issue 7 years ago • 3 comments

CLI streaming mode is broken. When including the --stream option, the output is incorrect, and moreover the behavior changes depending on where the option flag is inserted.

EXAMPLE 1

geojson-merge test_1.geojson test_2.geojson > test_combined.geojson --stream

This results in a file test_combined.geojson that is smaller than test_1.geojson and is missing many of it's features. (I've attached all 3 files - need to remove the .txt extension because it wouldn't let me upload .geojson)

test_combined.geojson.txt test_1.geojson.txt test_2.geojson.txt

EXAMPLE 2

geojson-merge --stream test_1.geojson test_2.geojson > test_combined.geojson

Using streaming flag before args will cause first file to be excluded from merge.


(Version: 1.0.2)

ykessler avatar Sep 19 '18 14:09 ykessler

@ykessler Did you resolve this? I have the same issue with my big geojson file. It is about 1GB

anphanngocvn avatar May 08 '19 01:05 anphanngocvn

@annphan Nope. I ended up doing it the old-fashioned way: I stripped the top level element from the geojson files, so that they were just rootless feature collections, and used trusty old cat command to combine them. Easy enough.

ykessler avatar May 08 '19 02:05 ykessler

@annphan Nope. I ended up doing it the old-fashioned way: I stripped the top level element from the geojson files, so that they were just rootless feature collections, and used trusty old cat command to combine them. Easy enough.

Had the same issue, ended up finding this issue, was about to follow your path but since I had too much data and vim was getting slow here's what I did instead, hopefully it will be useful to anyone in the same situation ending up here: jq -s '.[0].features=([.[].features]|flatten)|.[0]' *.geojson >> merged.geojson

vhf avatar Feb 11 '20 21:02 vhf