These functions convert an ordinary (non-temporal) geometry into the H3 cell or cell set that covers it at a given resolution, and test whether a temporal H3 trajectory ever enters that cell set. The cell-set output together with the ever-intersects predicate form the cross-platform spatial prefilter used by the portable BerlinMOD queries.
Return the H3 cell that contains a point geometry at the given resolution. The geometry must be a POINT.
geoToH3Cell(geometry,integer) → h3index
SELECT geoToH3Cell(geometry 'SRID=4326;Point(4.35 50.85)', 7); -- 871fa4418ffffff
Return the set of H3 cells covering a geometry at the given resolution. Every geometry type is supported: a POINT yields a single cell, a LINESTRING samples its segments, a POLYGON fills its interior, and MULTI* / GEOMETRYCOLLECTION values return the union of their components.
geoToH3IndexSet(geometry,integer) → h3indexset
SELECT geoToH3IndexSet(geometry 'SRID=4326;Point(4.35 50.85)', 7);
-- {"871fa4418ffffff"}
Return whether a temporal H3 trajectory ever takes one of the cells in a cell set. Combined with geoToH3IndexSet it answers whether a trip ever passes through a region, without materialising the trajectory geometry — the sound, conservative prefilter for the exact eIntersects(geometry,th3index).
ever_eq(h3indexset,th3index) → boolean
h3indexset ?= th3index → boolean
SELECT geoToH3IndexSet(geometry 'SRID=4326;Point(4.35 50.85)', 7) ?= th3index '871fa4418ffffff@2001-01-01'; -- true