Skip to content

Instantly share code, notes, and snippets.

@tommorris
Created April 3, 2024 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommorris/990263a8b15121e5b9bb15edec8a4c8f to your computer and use it in GitHub Desktop.
Save tommorris/990263a8b15121e5b9bb15edec8a4c8f to your computer and use it in GitHub Desktop.
QuackOSM + DuckDB + GeoParquet for rapid pub location
-- 1. install QuackOSM and DuckDB
-- 2. get a city/country pbf from http://download.geofabrik.de/
-- 3. run `quackosm ./greater-london-latest.osm.pbf` and wait
-- 4. run `duckdb` and...
install spatial;
load spatial;
select *,
tags['name'] as poi_name,
tags['amenity'] as amenity,
ST_Distance(st_centroid(ST_GeomFromWKB(geometry)), ST_POINT(0, 0)) as dist -- set your location here!
from read_parquet('files/greater-london-latest_nofilter_noclip_compact.geoparquet')
where amenity = ['pub']
and poi_name != []
order by dist
limit 5;
-- you now have the five nearest pubs to your location, enjoy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment