Created
July 27, 2023 21:53
-
-
Save thisisaaronland/55061c8a4c0f0618be58531436540002 to your computer and use it in GitHub Desktop.
Exporting Overture places parquet databases to GeoJSONSeq files
This file contains 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
#!/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