ST_LongFromGeoHash¶
TL;DR¶
ST_LongFromGeoHash decodes a GeoHash and returns the longitude of its cell center.
Syntax¶
ST_LongFromGeoHash(geohash)
Arguments¶
geohash is a VARCHAR GeoHash string.
Return Value¶
Returns the decoded center longitude as FLOAT64.
Usage Notes¶
The result is the center of the encoded cell, so GeoHash precision controls the accuracy of a decoded coordinate. Invalid GeoHash characters are rejected.
Examples¶
DROP DATABASE IF EXISTS geo_st_longfromgeohash_demo;
CREATE DATABASE geo_st_longfromgeohash_demo;
USE geo_st_longfromgeohash_demo;
SELECT ST_LongFromGeoHash('ezs42') AS longitude;
SELECT ST_LongFromGeoHash(ST_GeoHash(12.5, -7.25, 20)) AS round_trip_longitude;
DROP DATABASE geo_st_longfromgeohash_demo;