Generate a Geohash string from a point or coordinates. This function encodes spatial locations into short, alphanumeric strings for efficient indexing and proximity searches.
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 function decodes a given geohash and returns the latitude.
This page is licensed: CC BY-SA / Gnu FDL
ST_GeoHash(longitude, latitude, max_length)
ST_GeoHash(point, max_length)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 |
+----------------------------------------------+---------------------+