Return the resolution of each cell in a trajectory
getResolution(cell) → integer getResolution(tcell) → tint
Return the resolution of a cell, as an integer from the static form and as a tint of the resolution of each cell in a trajectory from the temporal one. QUADBIN calls it a zoom level and S2 a level, and the range belongs to the grid: 0 to 15 for H3, 0 to 26 for QUADBIN, 0 to 30 for S2.
SELECT getResolution(h3index '831c02fffffffff'); -- 3 SELECT getResolution(th3index '831c02fffffffff@2001-01-01'); -- 3@2001-01-01 SELECT getResolution(tquadbin '48a6227affffffff@2001-01-01'); -- 10@2001-01-01 SELECT getResolution(ts2cell '47c3c@2001-01-01'); -- 7@2001-01-01
Return a temporal boolean stating at each instant whether the value is a valid cell
isValidCell(cell) → boolean isValidCell(tcell) → tbool
A value is a valid cell when its bit pattern denotes something its grid indexes: for QUADBIN, tile coordinates within the bounds of the resolution the identifier states; for H3, a base cell and digit sequence the icosahedron carries; for S2, a face and a Hilbert position at a level between 0 and 30.
Only H3 can be asked the question of a value that answers false: its input function admits any bit pattern and leaves the verdict to this function, while the QUADBIN and the S2 input functions reject a pattern that indexes nothing, so tquadbin '0' and ts2cell '0' raise an error before the call is made.
SELECT isValidCell(quadbin '48a6227affffffff'); -- t SELECT isValidCell(th3index '831c02fffffffff@2001-01-01'); -- t@2001-01-01 SELECT isValidCell(th3index '0@2001-01-01'); -- f@2001-01-01 SELECT isValidCell(tquadbin '48a6227affffffff@2001-01-01'); -- t@2001-01-01 SELECT isValidCell(ts2cell '47c3c@2001-01-01'); -- t@2001-01-01