Hello,
Please, can you tell me why I can’t get curtains boundaries of Administrative level 8 when I query it on bigquery but when I look it into openstreetmap.org it is available.
For example, the suburb Ouakam boundaries in Senegal :
Then, when i load all admin level 8 of Senegal from bigquery public datasets, it can not find it.
Here the code source :
-- This exemple get the level 8 (communes) of Senegal
WITH bounding_area as (
SELECT
osm_id,
geometry,
IF(tags.key = "name:en", tags.value, NULL) as country_name_en,
FROM `bigquery-public-data.geo_openstreetmap.planet_features`, UNNEST(all_tags) as tags
WHERE feature_type="multipolygons"
AND (
("name:en", "Senegal") IN (SELECT (key, value) from unnest(all_tags))
)
AND ("boundary", "administrative") IN (SELECT (key, value) from unnest(all_tags))
AND IF(tags.key = "name:en", tags.value, NULL) is not NULL
),
results as (
SELECT
planet_features.osm_id as geolocation_id,
feature_type,
bounding_area.country_name_en as country_name_en,
IF(tags.key = "boundary", tags.value, NULL) as boundary_type,
IF(tags.key = "name", tags.value, NULL) as boundary_name,
ST_ASTEXT(planet_features.geometry) as geometry
FROM `bigquery-public-data.geo_openstreetmap.planet_features` planet_features, bounding_area, UNNEST(all_tags) as tags
WHERE feature_type="multipolygons"
AND ("admin_level", "8") IN (SELECT (key, value) FROM UNNEST(all_tags))
AND ("boundary", "administrative") IN (SELECT (key, value) FROM UNNEST(all_tags))
AND ST_DWithin(bounding_area.geometry, planet_features.geometry, 0)
AND IF(tags.key = "name", tags.value, NULL) is not NULL
)
SELECT * FROM results
(It is about a total of 20 level 8 boundaries of Senegal)
Thanks for your help!