Can not get admin boundaries in Bigquery public datasets but available on OSM.org

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!

You may need to contact Google consumer support, if I understand right who runs it. (no idea how to this in way that achieves some good results)

See also BQ data does not update · Issue #38 · gcp-pdp/geo-openstreetmap · GitHub so maybe this copy of OSM data is simply broken.

You may also use OpenStreetMap data obtained from place that is better than Google at maintaining their copy. See Downloading data - OpenStreetMap Wiki

2 Likes

So considering that the OSM data in BigQuery might not be updated, I checked and found that the latest update of the geo-openstreetmap dataset in BigQuery was on 11-Nov-2022.