# Common - Encode

## Encode Lat/Lng to GeoHash

<mark style="color:green;">`POST`</mark> `/api/common`

Returns the GeoHash for the lat/lng provided. If precision is auto, the result will be max 12 char length.\
The max precision of a GeoHash is based on the decimals of the initial Lat/Lng, for more precision ensure the Lat/Lng is the most accurate as possible.

**Body**

| Param     | Value/Type | Description |
| --------- | ---------- | ----------- |
| function  | 'encode'   | Static      |
| latitude  | float      |             |
| precision | int        | 0 = Auto    |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "geo_hash": "gbuw6fyprdsg"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Error Message Here"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.systemsx.co.uk/geo/common-encode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
