ST_LatFromGeoHash

TL;DR

ST_LatFromGeoHash 解码 GeoHash,并返回其单元中心点的纬度。

语法

ST_LatFromGeoHash(geohash)

参数说明

geohashVARCHAR GeoHash 字符串。

返回值

返回解码后的中心纬度,类型为 FLOAT64

使用说明

结果表示 GeoHash 单元中心,因此重新解码已编码坐标得到的值可能接近而非完全等于原始纬度。无效 GeoHash 字符会被拒绝。

示例

DROP DATABASE IF EXISTS geo_st_latfromgeohash_demo;
CREATE DATABASE geo_st_latfromgeohash_demo;
USE geo_st_latfromgeohash_demo;

SELECT ST_LatFromGeoHash('ezs42') AS latitude;
SELECT ST_LatFromGeoHash(ST_GeoHash(12.5, -7.25, 20)) AS round_trip_latitude;

DROP DATABASE geo_st_latfromgeohash_demo;

另请参阅

ST_GeoHashST_LongFromGeoHashST_PointFromGeoHash