ST_GeoHash
ST_GeoHash was added in MariaDB 12.0.
Syntax
ST_GeoHash(longitude, latitude, max_length)
ST_GeoHash(point, max_length)
Description
Returns the geohash corresponding to the input values, or NULL if any argument is NULL. Geohashes encode latitude and longitude coordinates into a text string made up only of numeric and lowercase latin letter characters.
The longitude
parameter is a numeric value in the interval [180, -180]. latitude
is a numeric value in the interval [90, -90].
In the case of point
, the x coordinate is treated as the latitude and the y coordinate is treated as the latitude. The same constraints apply.
The max_length
parameter is the upper limit on the resulting string size and cannot exceed 100.
The ST_LatFromGeoHash function decodes a given geohash and returns the latitude.
Examples
SELECT ST_GeoHash(ST_GeomFromText('POINT(1 1)'),15), ST_GeoHash(0,30,15);
+----------------------------------------------+---------------------+
| ST_GeoHash(ST_GeomFromText('POINT(1 1)'),15) | ST_GeoHash(0,30,15) |
+----------------------------------------------+---------------------+
| s00twy01mtw037m | sj248j248j248j2 |
+----------------------------------------------+---------------------+
See Also
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?