Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thisisaaronland/55061c8a4c0f0618be58531436540002 to your computer and use it in GitHub Desktop.
Save thisisaaronland/55061c8a4c0f0618be58531436540002 to your computer and use it in GitHub Desktop.
Exporting Overture places parquet databases to GeoJSONSeq files
#!/bin/sh
# This assumes that you have installed duckdb and that both /usr/local/data/overture/places and
# /usr/local/data/overture/places-geojson exist and that the Overture "places" parquet files have
# been downloaded in to the former. See also: https://github.com/OvertureMaps/data#3-duckdb-sql
for f in /usr/local/data/overture/places/*
do
f=`basename $f`
echo "process $f"
duckdb -c "LOAD spatial;COPY (SELECT id, updatetime, version, confidence, JSON(websites) AS websites, JSON(socials) AS social, JSON(emails) AS emails, JSON(brand) AS brand, JSON(addresses) AS addresses, JSON(categories) AS categories, JSON(sources) AS sources, ST_GeomFromWkb(geometry) AS geometry FROM read_parquet('/usr/local/data/overture/places/${f}', filename=true, hive_partitioning=1)) TO '/usr/local/data/overture/places-geojson/${f}.geojsonl' WITH (FORMAT GDAL, DRIVER 'GeoJSONSeq');"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment