Geospatial Functions

Geospatial functions allow working with location-based data, including points, coordinates, polygons, and spatial indexes. They enable conversion, querying, and analysis of geographic information

H3 Functions

H3_LATLNG_TO_CELL

Converts latitude/longitude into an H3 cell index (INT).

H3_LATLNG_TO_CELL(lat, lng, res)

H3_LATLNG_TO_CELLADDRESS

Converts lat/lng into an H3 cell address (STRING).

H3_LATLNG_TO_CELLADDRESS(lat, lng, res)

H3_CELL_TO_PARENT

Gets the parent cell index for a given cell.

H3_CELL_TO_PARENT(cell, parent_res)

H3_CELLADDRESS_TO_PARENT

Gets the parent cell address for a given cell address.

H3_CELLADDRESS_TO_PARENT(cell_address, parent_res)

H3_CELL_TO_CELLADDRESS

Converts an H3 numeric cell index to its alphanumeric cell address.

H3_CELLADDRESS_TO_CELL

Converts H3 cell address back to numeric index.

H3_CELL_TO_LATLNG

Returns the lat/lng center of a cell as an array [lat, lng].

H3_CELLADDRESS_TO_LATLNG

Returns the lat/lng center of a cell address.

H3_CELL_TO_BOUNDARY_AS_GEOJSON

Returns the cell boundary as a GeoJSON polygon.

H3_POINT_TO_CELL

Converts an ST_POINT geometry to an H3 index.

H3_POINT_TO_CELLADDRESS

Converts an ST_POINT geometry to an H3 cell address.

H3_POLYGON_TO_CELLS

Returns list of H3 cell indices covering a GeoJSON polygon.

H3_POLYGON_TO_CELLADDRESSES

Returns list of H3 cell addresses covering a GeoJSON polygon.

H3_GRID_DISK

Returns neighboring cells within hex distance k.

Bing Tile Functions

BING_TILE_AT

Returns the Bing tile ID at the given location and zoom level.

BING_TILE_QUADKEY

Converts a Bing tile ID to its QuadKey representation.

ST Functions

ST_POINT

Creates a GEOGRAPHY point (lng, lat).

ST_CONTAINS

Checks whether one geography fully contains another.

Last updated