Skip to content

Instantly share code, notes, and snippets.

@maptastik
Created November 22, 2019 17:15
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 maptastik/3bb5cf3449dad08a4744598f4e6b320c to your computer and use it in GitHub Desktop.
Save maptastik/3bb5cf3449dad08a4744598f4e6b320c to your computer and use it in GitHub Desktop.
An example of an ETL script that allows you to query a remote spatial data source and join the query result with a CSV. For now, this requires csvs-to-sqlite as ogr2ogr doesn't seem to like working with CSVs with the SQLite dialect for SQL queries. O
csvs-to-sqlite tbl.csv tbl.db && \
curl "<URL to enpoint and/or query that returns GeoJSON>" | \
ogr2ogr -f geojson -nln input /vsistdout/ /vsistdin/ | \
ogr2ogr -f geojson \
-dialect sqlite \
-sql "select input.*, tbl.* from inputjoin 'tbl.db'.tbl AS tbl on input.<primary key> = tbl.<foreign key>" \
output.geojson /vsistdin/ && \
del tbl.db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment