
Spatial Extension for BigQuery
Unlock Spatial Analytics on BigQuery
s2
Our S2 module is based on a port of the official s2 geometry library created by Google. For more information about S2 check the library’s website or the Overview section of this documentation.
ID_FROMHILBERTQUADKEY
Description
Returns the conversion of a Hilbert quadkey (a.k.a Hilbert curve quadtree ID) into a S2 cell ID.
hquadkey
:STRING
Hilbert quadkey to be converted.
Return type
INT64
Example
|
|
HILBERTQUADKEY_FROMID
Description
Returns the conversion of a S2 cell ID into a Hilbert quadkey (a.k.a Hilbert curve quadtree ID).
id
:INT64
S2 cell ID to be converted.
Return type
STRING
Example
|
|
LONGLAT_ASID
Description
Returns the S2 cell ID for a given longitude, latitude and zoom resolution.
longitude
:FLOAT64
horizontal coordinate on the map.latitude
:FLOAT64
vertical coordinate on the map.resolution
:INT64
level of detail or zoom.
Return type
INT64
Example
|
|
ST_ASID
Description
Returns the S2 cell ID of a given point at a given level of detail.
point
:GEOGRAPHY
point to get the ID from.resolution
:INT64
level of detail or zoom.
Return type
INT64
Example
|
|
ST_BOUNDARY
Description
Returns the boundary for a given S2 cell ID. We extract the boundary by getting the corner longitudes and latitudes, then enclose it in a GeoJSON and finally transform it into geography.
id
:INT64
S2 cell ID to get the boundary geography from.
Return type
GEOGRAPHY
Example
|
|
VERSION
Description
Returns the current version of the S2 module.
Return type
STRING
Example
|
|