Created
December 15, 2023 15:01
-
-
Save Youssef-Harby/10fd5295fefabe2b20d93aae795c25db to your computer and use it in GitHub Desktop.
OvertureMaps Duckdb Scripts
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
import duckdb | |
con = duckdb.connect('./duckdb.duckdb') | |
data = """ | |
SET memory_limit = '32GB'; | |
SET threads TO 16; | |
SET enable_progress_bar = true; | |
SET enable_progress_bar_print = true; | |
INSTALL httpfs; | |
INSTALL spatial; | |
LOAD httpfs; | |
LOAD spatial; | |
COPY ( | |
SELECT | |
type, | |
version, | |
CAST(updatetime as varchar) as updateTime, | |
height, | |
numfloors as numFloors, | |
level, | |
class, | |
JSON(names) as names, | |
JSON(sources) as sources, | |
ST_GeomFromWKB(geometry) as geometry | |
FROM read_parquet('s3://overturemaps-us-west-2/release/2023-12-14-alpha.0/theme=buildings/type=*/*', hive_partitioning=1) | |
WHERE | |
bbox.minx > 31.26500 | |
AND bbox.maxx < 31.29643 | |
AND bbox.miny > 30.07066 | |
AND bbox.maxy < 30.10207 | |
) TO 'egypt_cairo_hadaiq_el_qubbah_yharby_buildings.gpkg' | |
WITH (FORMAT GDAL, DRIVER 'GPKG', SRS 'EPSG:4326'); | |
""" | |
results = con.execute(data).fetchall() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment