Топ-100
 

ST_GEOHASH

RDBMS Type: MySQL
Topic

ST_GeoHash(longitude, latitude, max_length), ST_GeoHash(point,
max_length)

Returns a geohash string in the connection character set and collation.

For the first syntax, the longitude must be a number in the range
[?180, 180], and the latitude must be a number in the range [?90,
90]. For the second syntax, a POINT value is required, where the X and
Y coordinates are in the valid ranges for longitude and latitude,
respectively.

The resulting string is no longer than max_length characters, which has
an upper limit of 100. The string might be shorter than max_length
characters because the algorithm that creates the geohash value
continues until it has created a string that is either an exact
representation of the location or max_length characters, whichever
comes first.

ST_GeoHash() handles its arguments as described in the introduction to
this section.

URL: https://dev.mysql.com/doc/refman/8.0/en/spatial-geohash-functions.html

Example

mysql> SELECT ST_GeoHash(180,0,10), ST_GeoHash(-180,-90,15);
+----------------------+-------------------------+
| ST_GeoHash(180,0,10) | ST_GeoHash(-180,-90,15) |
+----------------------+-------------------------+
| xbpbpbpbpb | 000000000000000 |
+----------------------+-------------------------+