Created
April 3, 2024 16:18
-
-
Save tommorris/990263a8b15121e5b9bb15edec8a4c8f to your computer and use it in GitHub Desktop.
QuackOSM + DuckDB + GeoParquet for rapid pub location
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
-- 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