Return the temporal cell at the given resolution that contains each point in a temporal geodetic or planar point
th3index(tpoint,integer) → th3index
SRID must be 4326 for the tgeompoint overload. The constructor over a temporal point is stated for H3 alone: the QUADBIN and S2 forms are not yet implemented, and a trajectory reaches those grids through the per-instant cell of its positions.
SELECT getResolution(th3index(tgeogpoint 'POINT(-73.96 40.78)@2001-01-01', 9)); -- 9@2001-01-01 SELECT getResolution(th3index(tgeompoint 'SRID=4326;POINT(-73.96 40.78)@2001-01-01', 9)); -- 9@2001-01-01
Return the temporal geodetic centroid of each cell in a trajectory
cellToPoint(cell) → geometry cellToPoint(tcell) → tgeogpoint tgeompoint(tcell) → tgeompoint
The tgeompoint form answers the same centroid as an SRID-4326 planar point, and H3 is the one grid publishing both forms. The operation is named cellToPoint for every grid, the cell_to_point slot of the descriptor being what fixes it.
SELECT ST_AsText(cellToPoint(h3index '871fa44a8ffffff'), 6); -- POINT(4.297401 50.8043) SELECT asText(cellToPoint(th3index '871fa44a8ffffff@2001-01-01'), 6); -- POINT(4.297401 50.8043)@2001-01-01 SELECT asText(tgeompoint(th3index '871fa44a8ffffff@2001-01-01'), 6); -- POINT(4.297401 50.8043)@2001-01-01 SELECT asText(cellToPoint(tquadbin '48a6227affffffff@2001-01-01'), 6); -- POINT(4.394531 50.847573)@2001-01-01 SELECT asText(cellToPoint(ts2cell '47c3c@2001-01-01'), 6); -- POINT(4.222019 50.936164)@2001-01-01
Return the temporal polygon boundary of each cell in a trajectory, as a temporal geography
cellToBoundary(cell) → geometry cellToBoundary(tcell) → tgeography
Return the polygon boundary of a cell in SRID 4326. The static form takes a single cell; the temporal form returns the boundary of each cell in a trajectory. The ring closes on its first vertex, so an H3 hexagon carries seven points and a QUADBIN square or an S2 spherical quadrilateral five.
SELECT ST_NPoints(cellToBoundary(h3index '871fa44a8ffffff')); -- 7 SELECT ST_GeometryType(getValue(cellToBoundary(th3index '871fa44a8ffffff@2001-01-01'))::geometry); -- ST_Polygon SELECT ST_NPoints(getValue(cellToBoundary(th3index '871fa44a8ffffff@2001-01-01'))::geometry); -- 7 SELECT ST_GeometryType(getValue(cellToBoundary(tquadbin '48a6227affffffff@2001-01-01'))::geometry); -- ST_Polygon SELECT ST_NPoints(getValue(cellToBoundary(tquadbin '48a6227affffffff@2001-01-01'))::geometry); -- 5 SELECT ST_GeometryType(getValue(cellToBoundary(ts2cell '47c3c@2001-01-01'))::geometry); -- ST_Polygon SELECT ST_NPoints(getValue(cellToBoundary(ts2cell '47c3c@2001-01-01'))::geometry); -- 5