> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_geohash.md).

# ST\_GeoHash

{% hint style="info" %}
ST\_GeoHash is available from [MariaDB 12.0](/docs/release-notes/community-server/old-releases/12.0/what-is-mariadb-120.md).
{% endhint %}

## Syntax

```bnf
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 longitude 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](/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_latfromgeohash.md) function decodes a given geohash and returns the latitude.

## Examples

```sql
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

* [ST\_LatFromGeoHash](/docs/server/reference/sql-statements/geometry-constructors/miscellaneous-gis-functions/st_latfromgeohash.md)
* [Geometry Constructors](/docs/server/reference/sql-statements/geometry-constructors.md)
* [ST\_GeomFromText](/docs/server/reference/sql-statements/geometry-constructors/wkt/st_geomfromtext.md)

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
