Created
October 3, 2022 16:07
-
-
Save wriglz/39143445316ff9c33fe4716145b163b7 to your computer and use it in GitHub Desktop.
SQL to query OSM data on Google BigQuery
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
SELECT | |
osm_id, | |
feature_type, | |
osm_timestamp, | |
geometry, | |
-- Here we are going to extract a couple of attributes from the all_tags array: | |
(SELECT value FROM UNNEST(all_tags) WHERE key = 'name' ) AS name, | |
(SELECT value FROM UNNEST(all_tags) WHERE key = 'addr:city') AS city | |
FROM | |
bigquery-public-data.geo_openstreetmap.planet_features | |
WHERE | |
('amenity', 'pub') IN ( -- the Key Value pair that you want to search for. | |
SELECT | |
(key, value) | |
FROM | |
UNNEST(all_tags)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment