地理函数
这个页面列出了 GreptimeDB 中的所有地理空间相关函数。当您启用了
common-function/geo 特性(默认为开启状态)时,这些函数才会生效。
- Geo 数据类型函数
- Geohash
- H3
h3_latlng_to_cellh3_latlng_to_cell_stringh3_cell_to_stringh3_string_to_cellh3_cell_center_latlngh3_cell_resolutionh3_cell_baseh3_cell_is_pentagonh3_cell_parenth3_cell_to_childrenh3_cell_to_children_sizeh3_cell_to_child_posh3_child_pos_to_cellh3_cells_containsh3_grid_diskh3_grid_disk_distancesh3_grid_distanceh3_grid_path_cellsh3_distance_sphere_kmh3_distance_degree
- S2
- 编码
- 空间关系
- 空间测量
Geo 数据类型函数
地理相关数据类型转换。
wkt_point_from_latlng
将纬度、经度转换成 WKT 点。
SELECT wkt_point_from_latlng(37.76938, -122.3889) AS point;
Geohash
了解 更多关于 geohash 编码。
geohash
从纬度、经度和分辨率获取 geohash 编码的字符串。
SELECT geohash(37.76938, -122.3889, 11);
geohash_neighbours
给定坐标和分辨率获取所有 geohash 邻接点。
请注意,此函数返回一个字符串数组,并且仅在我们的 HTTP 查询 API 和 Postgres 通道上生效。
SELECT geohash_neighbours(37.76938, -122.3889, 11);
H3
H3 地理坐标编码算法。了解更多。
h3_latlng_to_cell
将坐标(纬度,经度)编码为指定分辨率下的 h3 索引,并返回该单元格的 UInt64 表示。
SELECT h3_latlng_to_cell(37.76938, -122.3889, 1);
h3_latlng_to_cell_string
类似于 h3_latlng_to_cell ,但返回字符串编码格式。
h3_latlng_to_cell_string(37.76938, -122.3889, 1);