ST_H3FromLatLng

更新时间: 2026-03-28 13:49:45

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

ParameterTypeDescriptionDefault
latfloatThe latitude.—
lngfloatThe longitude.—
levelintegerThe 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
-----------------
 8f4a1266884c4f0
SELECT ST_AsText(ST_H3FromLatLng(20.5, 128.2, 8));

Result:

    st_astext
-----------------
 884a126689fffff
上一篇: ST_H3FromInt 下一篇: Spatial operation functions
阿里云首页 云数据库 RDS 相关技术圈