Skip to content

Instantly share code, notes, and snippets.

@missinglink
Last active March 3, 2020 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save missinglink/342ea4bd4c6f735a9e3c5af137d10b73 to your computer and use it in GitHub Desktop.
Save missinglink/342ea4bd4c6f735a9e3c5af137d10b73 to your computer and use it in GitHub Desktop.
Convert a stream of geojson features to a feature collection
#!/bin/bash
featureCollectionSandwich() {
echo '{ "type": "FeatureCollection", "features":'
cat - | jq -s .
echo '}'
}
source featureCollectionSandwich.sh
sqlite3 /data/wof/whosonfirst-data-latest.db 'SELECT body FROM geojson WHERE id<2' | featureCollectionSandwich > out.geojson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment