Converts a latitude and longitude pair into an H3Grid object at the specified grid level.
Syntax
h3grid ST_H3FromLatLng(float lat, float lng, integer level)Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
lat | float | The latitude. | — |
lng | float | The longitude. | — |
level | integer | The layer of the grid. | 15 |
Examples
The following examples convert the coordinate (20.5, 128.2) to an H3Grid object.
SELECT ST_AsText(ST_H3FromLatLng(20.5, 128.2));Result:
st_astext
-----------------
8f4a1266884c4f0SELECT ST_AsText(ST_H3FromLatLng(20.5, 128.2, 8));Result:
st_astext
-----------------
884a126689fffff