Skip to content

Instantly share code, notes, and snippets.

@whyvez
Created May 31, 2018 00:45
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 whyvez/db7556e3826b62cefa3484f7dac97ec3 to your computer and use it in GitHub Desktop.
Save whyvez/db7556e3826b62cefa3484f7dac97ec3 to your computer and use it in GitHub Desktop.
maps each layer in input file into separate GeoJSON file
#!/usr/bin/env bash
# desc: maps each layer in input file into separate GeoJSON file
# usage: ./split human_footprint.gdb
# dep: gdal, awk, parallel
input="$1"
ogrinfo "$input" \
| awk '{if (NR > 2) print $2}' \
| parallel "ogr2ogr -f 'GeoJSON' -t_srs EPSG:4326 -sql 'select VALUE from {}' {}.geojson $input"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment