Skip to content

Instantly share code, notes, and snippets.

@djouallah
Created July 10, 2020 15:49
Show Gist options
  • Save djouallah/6372f6d6de2886c7d632f8207de50644 to your computer and use it in GitHub Desktop.
Save djouallah/6372f6d6de2886c7d632f8207de50644 to your computer and use it in GitHub Desktop.
with raw as (SELECT
ar.key as key,
ar.value as category,
concat(osm_id,osm_way_id) as Index,geometry,
ST_CENTROID(geometry) AS center_location,
st_x(ST_CENTROID(geometry)) as x,
st_y(ST_CENTROID(geometry)) as y
FROM
`bigquery-public-data.geo_openstreetmap.planet_features`,
UNNEST(all_tags) AS ar
WHERE
('amenity') in (
SELECT
(key)
FROM
UNNEST(all_tags)))
select DISTINCT Index as index,x,y,category from raw where key="amenity"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment