Restrict a temporal cell to (the complement of) a cell or a set of cells
atValue(tcell,cell) → tcell minusValue(tcell,cell) → tcell atValues(tcell,cellset) → tcell minusValues(tcell,cellset) → tcell
SELECT atValue(th3index '{871fa4418ffffff@2001-01-01,
871fa44a8ffffff@2001-01-02}', h3index '871fa4418ffffff');
-- {871fa4418ffffff@2001-01-01}
SELECT atValue(tquadbin '{48a6227affffffff@2001-01-01, 485623ffffffffff@2001-01-02}',
quadbin '48a6227affffffff');
-- {48a6227affffffff@2001-01-01}
SELECT atValue(ts2cell '{47c3c@2001-01-01, 47c4@2001-01-02}',
s2cell '47c3c');
-- {47c3c@2001-01-01}
Restrict a temporal cell to (the complement of) a time value
atTime(tcell,times) → tcell minusTime(tcell,times) → tcell
SELECT atTime(th3index '[871fa4418ffffff@2001-01-01, 871fa4418ffffff@2001-01-04]', tstzspan '[2001-01-02, 2001-01-03]'); -- [871fa4418ffffff@2001-01-02, 871fa4418ffffff@2001-01-03] SELECT atTime(tquadbin '[48a6227affffffff@2001-01-01, 48a6227affffffff@2001-01-04]', tstzspan '[2001-01-02, 2001-01-03]'); -- [48a6227affffffff@2001-01-02, 48a6227affffffff@2001-01-03] SELECT atTime(ts2cell '[47c3c@2001-01-01, 47c3c@2001-01-04]', tstzspan '[2001-01-02, 2001-01-03]'); -- [47c3c@2001-01-02, 47c3c@2001-01-03]
Restrict a temporal QUADBIN, H3 or S2 cell to (the complement of) a spatiotemporal box
atStbox(tquadbin,stbox,borderInc boolean=true) → tquadbin minusStbox(tquadbin,stbox,borderInc boolean=true) → tquadbin atStbox(th3index,stbox,borderInc boolean=true) → th3index minusStbox(th3index,stbox,borderInc boolean=true) → th3index atStbox(ts2cell,stbox,borderInc boolean=true) → ts2cell minusStbox(ts2cell,stbox,borderInc boolean=true) → ts2cell
A cell lies in a box at an instant when its tile, with the boundary points it owns, shares a point with the box. A tile holds its west and north boundaries and its north-west corner, and a tile of the last row its south boundary too, as for tquadbin, so a box touching a tile only along its east meridian or its south parallel leaves it out. The box holds its upper borders unless borderInc is false. The box has the SRID 4326 of the cell; a box with the time dimension alone restricts the value to its period.
SELECT asText(atStbox(tquadbin(quadbinTileToCell(0, 0, 1), timestamptz '2001-01-01'),
stbox 'SRID=4326;STBOX X((0,10),(10,20))'));
-- NULL
SELECT asText(atStbox(tquadbin(quadbinTileToCell(1, 0, 1), timestamptz '2001-01-01'),
stbox 'SRID=4326;STBOX X((0,10),(10,20))'));
-- 4817ffffffffffff@2001-01-01
SELECT asText(atStbox(tquadbin '[4817ffffffffffff@2001-01-01, 4813ffffffffffff@2001-01-02,
4817ffffffffffff@2001-01-03]', stbox 'SRID=4326;STBOX X((10,10),(20,20))'));
/* {[4817ffffffffffff@2001-01-01, 4817ffffffffffff@2001-01-02),
[4817ffffffffffff@2001-01-03]} */
SELECT asText(minusStbox(tquadbin '[4817ffffffffffff@2001-01-01, 4813ffffffffffff@2001-01-02,
4817ffffffffffff@2001-01-03]', stbox 'SRID=4326;STBOX X((10,10),(20,20))'));
-- {[4813ffffffffffff@2001-01-02, 4813ffffffffffff@2001-01-03)}
An H3 cell takes a geodetic box, and lies in it at an instant when the cell, with the boundary points it owns, shares a position with the box. The cell is the region its outline bounds, its edges great-circle arcs, holding its north and west sides, as for th3index. The box is read on its bounds, the meridians and parallels of its longitudes and latitudes, never on the polygon of its corners, whose edges are great circles that leave the parallels: in the box X((0,40),(90,50)) the cell around Point(45 55) lies inside the polygon of the corners and outside the box. A vertex of the cell lies in the box by its degrees, as a position does, and an edge enters it where its great circle crosses the meridians and parallels of the box, as the path of a tgeogpoint between two instants does, so a cell and a temporal geography point travelling along its edges are read alike. The cell itself is read on the geodetic positions of its vertices, which lie up to 5·10-15 degrees from their degrees, and the crossings of an edge with the parallels of the box are computed in floating-point trigonometry: a box whose bound passes that close to a vertex of a cell may be read on either side of it. An S2 cell is read alike, on the outline whose vertices are the corners of its tile of the cube, its edges great-circle arcs, holding its low-i and low-j sides and the corner between them, as for ts2cell.
SELECT asText(atStbox(th3index(h3index '832d5afffffffff', timestamptz '2001-01-01'), stbox 'SRID=4326;GEODSTBOX X((0,40),(90,50))')); -- 832d5afffffffff@2001-01-01 SELECT asText(atStbox(th3index(h3index '8310a5fffffffff', timestamptz '2001-01-01'), stbox 'SRID=4326;GEODSTBOX X((0,40),(90,50))')); -- NULL SELECT asText(atStbox(ts2cell '47c3c@2001-01-01', stbox 'SRID=4326;GEODSTBOX X((4,51),(5,52))')); -- 47c3c@2001-01-01 SELECT asText(atStbox(ts2cell '47c3c@2001-01-01', stbox 'SRID=4326;GEODSTBOX X((5,51),(6,52))')); -- NULL