Skip to content

Instantly share code, notes, and snippets.

@wriglz
Created November 8, 2022 14:23
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/676dbc40456c25ce8988c0f5b8c03bcf to your computer and use it in GitHub Desktop.
Save wriglz/676dbc40456c25ce8988c0f5b8c03bcf to your computer and use it in GitHub Desktop.
Script utlising CARTO H3 support to visualise OSM Edits for the United Kingdom
DECLARE
bbox GEOGRAPHY;
SET
bbox = (
SELECT
geom
FROM
`global_boundaries_dataset`
WHERE
NAME_EN = 'United Kingdom');
WITH
h3s AS (
SELECT
id,
`carto-un`.carto.H3_FROMGEOGPOINT(geometry,
8) AS h3
FROM
`bigquery-public-data.geo_openstreetmap.history_nodes`
WHERE
ST_INTERSECTS(geometry,bbox))
SELECT
COUNT(id) AS edit_count,
h3
FROM
h3s
GROUP BY
2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment