Skip to content

Instantly share code, notes, and snippets.

@wriglz
Created November 7, 2023 12:37
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 wriglz/396e2f0dfcbcac6a4a079903c9fc2ef2 to your computer and use it in GitHub Desktop.
Save wriglz/396e2f0dfcbcac6a4a079903c9fc2ef2 to your computer and use it in GitHub Desktop.
SQL to extract lighthouses from the BigQuery OSM dataset
SELECT
osm_id,
ST_CENTROID(geometry) AS geom,
(SELECT value FROM UNNEST(all_tags) WHERE key = 'name' ) AS name,
FROM
bigquery-public-data.geo_openstreetmap.planet_features
WHERE
('man_made', 'lighthouse') IN (
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