Created
November 22, 2019 17:15
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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