ST_LatFromGeoHash

TL;DR

ST_LatFromGeoHash decodes a GeoHash and returns the latitude of its cell center.

Syntax

ST_LatFromGeoHash(geohash)

Arguments

geohash is a VARCHAR GeoHash string.

Return Value

Returns the decoded center latitude as FLOAT64.

Usage Notes

The result represents the GeoHash cell center, so re-decoding an encoded coordinate can be close to, rather than exactly equal to, the original latitude. Invalid GeoHash characters are rejected.

Examples

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;

See Also

ST_GeoHash, ST_LongFromGeoHash, ST_PointFromGeoHash