Skip to content

S2_CellIdFromPoint

Returns the S2 cell ID containing the given point geography at the maximum S2 level (30).

Usage

int64 S2_CellIdFromPoint(geog: geography)

Arguments

  • geog (geography): Input geography

Description

Returns the 64-bit S2 cell ID at level 30 (the finest resolution) that contains the given point geography. Returns NULL for empty point geometries. This is useful for spatial indexing and efficient spatial queries.

Examples

SELECT S2_CellIdFromPoint(ST_GeogPoint(-64, 45));
┌────────────────────────────────────────────────────────┐
│ s2_cellidfrompoint(st_geogpoint(Int64(-64),Int64(45))) │
│                          int64                         │
╞════════════════════════════════════════════════════════╡
│                                    5429547630310317641 │
└────────────────────────────────────────────────────────┘