#DuckDB

7 posts

Two maps of candidate store sites on Albuquerque's arterial roads: on the left a weighted-overlay suitability score, brightest in the city centre, and on the right the spending a new Supercenter would capture under a Huff model, with the top five sites circled

Tutorial Python Part 3 of 3

GIS retail site selection in Python: drive-time catchments, suitability scoring and the Huff model

Choose where a new store should go with open data and Python. Build a drivable road network for Albuquerque from Overture Maps, spread American Community Survey households onto it, map 5, 10 and 15-minute catchments, score 918 candidate sites with a weighted overlay, estimate the spending each would capture with a Huff gravity model, and replay 2022 to see how a store Walmart closed in 2023 ranked.

Intermediate 11 min read

Choropleth of Valencia municipalities shaded by the share of residents living in flooded buildings, with the flood extent outlined in blue

Tutorial Python Part 3 of 6

Flood damage, exposure and population affected in Python: the Valencia floods of October 2024

Count the buildings, damage and people in the Valencia DANA flood of 29 October 2024 in Python: Copernicus EMS EMSR773 flood extents and damage grading, Overture Maps buildings with DuckDB, GHSL and WorldPop population grids checked against the INE register, and a per-municipality table and choropleth for responders.

Intermediate 14 min read

Line chart from 2017 to 2026 of radar backscatter over the Homewood and Chicago Chatham Walmart car parks relative to the open stores, both falling by about 1.5 to 2 dB after the stores closed in spring 2023

Tutorial Python Part 2 of 3

Car-park occupancy from Sentinel-1 radar in Python: Walmart store closures as a natural experiment

Measure how busy retail car parks are from free Sentinel-1 radar. Draw 45 Walmart Supercenter car parks in Chicagoland from Overture Maps, mask them to paved ground with NAIP aerial imagery, read every ascending pass since 2017, and test the signal on the 2023 store closures with a difference-in-differences and a placebo test.

Advanced 12 min read

Two maps of Glasgow with HDBSCAN clusters drawn as translucent coloured polygons over their points and grey noise points between them

Tutorial Python

DBSCAN and HDBSCAN spatial clustering in Python: finding Glasgow's dining districts

Cluster GPS and point-of-interest data in Python with DBSCAN and HDBSCAN: use the haversine metric on latitude and longitude or plain metres on a projected grid, choose eps with a k-distance plot, handle variable density with HDBSCAN, draw convex and concave hull polygons, treat noise properly, read silhouette and DBCV with care, and scale up with a BallTree. Uses 3,950 real Overture Maps restaurants, cafés and bars in Glasgow.

Intermediate 18 min read

Two maps of annual solar irradiation on roofs over a hillshade, from blue at 300 kWh/m² to red at 1,100 kWh/m² on south-facing slopes

Tutorial Python

Rooftop solar potential from LiDAR in Python: pvlib, PVGIS and shading for every roof

Estimate rooftop solar potential in Python for 2,148 buildings in Manchester: take a 1 m Environment Agency LiDAR DSM and Overture Maps footprints, compute roof slope and aspect, trace horizon angles for shading from neighbours and trees, build a sun map from a PVGIS typical year with pvlib, check it against pvlib's Perez model and PVGIS, then estimate kWp and kWh per year per roof and rank the best roofs.

Advanced 14 min read

Map of central Bristol with 144,965 Overture building footprints coloured by subtype, most of them residential, and the River Avon in blue

Tutorial Python Part 1 of 2

Query Overture Maps with DuckDB spatial and GeoParquet in Python

Pull Bristol's 144,965 buildings and 20,727 places straight from the Overture Maps GeoParquet release with DuckDB, run spatial SQL joins and H3 aggregation, load the result into GeoPandas, write GeoParquet 1.1, and time it against Shapefile, GeoPackage and FlatGeobuf.

Intermediate 13 min read