# Geohash convert

`geohash-convert` · version 1.0.0 · Other utilities · free, no key needed

Encode decimal coordinates as a bounded Geohash or decode a Geohash to its exact bounding box and midpoint.

**Use when you need to: encode coordinates as geohash · decode geohash bounding box · convert latitude longitude to geohash.**

## Decide before calling

Read the [versioned contract](/v1/tools/geohash-convert/versions/1.0.0) and the supported scope below. Reuse `geohash-convert@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `geohash-convert@1.0.0` for encode coordinates as geohash. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- encode coordinates as geohash
- decode geohash bounding box
- convert latitude longitude to geohash
- find geohash cell midpoint
- geohash to exact coordinate bounds
- create a spatial geohash key

## Not supported

- geocode an address or place name
- find neighboring geohash cells
- measure geographic distance
- convert another coordinate reference system

## Behavior

- Encode requires decimal-string latitude and longitude plus precision 1..12; decode requires one lowercase Geohash of 1..12 characters.
- Bisection starts with longitude and alternates axes; an exact midpoint selects the upper half (bit 1).
- The alphabet is 0123456789bcdefghjkmnpqrstuvwxyz; input is not trimmed or case-folded.
- Decoded bounds and midpoint are exact terminating decimal strings without exponent or trailing fractional zero.
- Coordinate spellings are canonicalized numerically; latitude is [-90,90] and longitude is [-180,180].

## Input

- `operation` (one of "encode", "decode", required)
- `latitude` (string, optional): min length 1; max length 32; pattern `^-?(?:0|[0-9]+)(?:\.[0-9]+)?$`
- `longitude` (string, optional): min length 1; max length 32; pattern `^-?(?:0|[0-9]+)(?:\.[0-9]+)?$`
- `precision` (integer, optional): min 1; max 12
- `geohash` (string, optional): min length 1; max length 12; pattern `^[0123456789bcdefghjkmnpqrstuvwxyz]+$`

## Output

- `operation` (one of "encode", "decode", required)
- `geohash` (string, required): min length 1; max length 12; pattern `^[0123456789bcdefghjkmnpqrstuvwxyz]+$`
- `precision` (integer, required): min 1; max 12
- `bounding_box` (object, optional)
- `midpoint` (object, optional)

## Limits

- max coordinate bytes: 32
- max geohash bytes: 12
- max precision: 12
- max bisection bits: 60

## Example

Request input:

```json
{
  "operation": "encode",
  "latitude": "42.6",
  "longitude": "-5.6",
  "precision": 5
}
```

Response:

```json
{
  "result": {
    "operation": "encode",
    "geohash": "ezs42",
    "precision": 5
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "geohash-convert",
  "version": "1.0.0",
  "input": {
    "operation": "encode",
    "latitude": "42.6",
    "longitude": "-5.6",
    "precision": 5
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/geohash-convert/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"operation":"encode","latitude":"42.6","longitude":"-5.6","precision":5}'
```

The machine-readable contract is at [/v1/tools/geohash-convert/versions/1.0.0](/v1/tools/geohash-convert/versions/1.0.0).

### CLI

```sh
node cli.mjs run geohash-convert 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Polygon measures compute](/tools/polygon-measures-compute): Compute exact signed double-area, area, orientation, and squared edge lengths for a rational simple polygon.
- [Xlsx to CSV](/tools/xlsx-to-csv): convert excel sheet to csv.
- [Xlsx to markdown](/tools/xlsx-to-markdown): convert excel workbook to markdown.
- [Hebrew civil date convert](/tools/hebrew-civil-date-convert): Convert dates between proleptic Gregorian calendar and civil Hebrew calendar
- [Rtf to markdown](/tools/rtf-to-markdown): Convert an 8 KiB ANSI-1252 RTF text subset to escaped Markdown; unsupported Word features are refused.
- [Har summarize](/tools/har-summarize): Summarize a HAR 1.2 JSON log into deterministic request, status, MIME, host, timing, size, and redaction counts.
