Reference material for ST_S2CELLIDFROMPOINT function
GEOGRAPHY
object.
ST_S2CELLIDFROMPOINT
exclusively supports single Point GEOGRAPHY
objects, and returns NULL
for all other values including
MultiPoint, LineString, Polygon, and an empty GEOGRAPHY
object.
Parameter | Description | Supported input types |
---|---|---|
<geo> | A single valid GEOGRAPHY Point for which ST_S2CELLIDFROMPOINT calculates and returns the S2 cell that covers it. | GEOGRAPHY |
<cell_level> | The resolution of the S2 cell to return. Valid levels range from 0, the coarsest level, to 30, the finest level. The default level is 30 if unspecified. | BIGINT |
ST_S2CELLIDFROMPOINT
returns a value of type BIGINT
, which may include negative values.
GEOGRAPHY
objects: a valid Point, an empty Point, and a LineString. The code example computes their S2 cell IDs at cell levels 30 and 10, returning results only for the valid Point:
id (INTEGER) | cell30 (BIGINT) | cell10 (BIGINT) |
---|---|---|
1 | 6093613931972369317 | 6093613287902019584 |
2 | NULL | NULL |
3 | NULL | NULL |
NULL
for the second input because it is empty and contains no geographic data, and for the third input because LineString is not a supported GEOGRAPHY
type.