Turn point data into an H3 map you can share
Consultants and data teams often need a density map a client can open in a browser. This example indexes every OpenStreetMap shop in central Osaka to an H3 cell at resolution 8 and draws the count per cell.
Shops per H3 cell in central Osaka
Data: OpenStreetMap shops
Method: index each shop to an H3 cell at resolution 8, count per cell, and draw the cell boundaries
-- Shops per H3 cell at resolution 8
WITH cells AS (
SELECT h3_latlng_to_cell(point(ST_X(geom), ST_Y(geom)), 8) AS cell
FROM osm.shop_point
WHERE geom && ST_MakeEnvelope(135.40, 34.60, 135.60, 34.75, 4326)
)
SELECT cell::text AS h3_cell,
COUNT(*) AS shops,
ST_SetSRID(h3_cell_to_boundary(cell)::geometry, 4326) AS geom
FROM cells
GROUP BY cell
ORDER BY shops DESC;
Counting first and drawing the boundaries afterwards keeps the grouping cheap.
Run it on your data
Point the query at your own table, or upload points as a file, and change 8 to pick another resolution. To deliver the result, embed the map in a client page, export it to QGIS, or read it through the REST API.
Frequently asked questions
Which databases can I query?
PostgreSQL with PostGIS, and GeoParquet files on S3. Queries on a connection are read-only and stop after 30 seconds.
Can the result refresh on its own?
Saved queries can refresh on an interval and update the derived layer.