Geohash encoder and decoder with neighbour cells
Geohash encoder and decoder: encode a WGS-84 latitude and longitude to a geohash at a chosen precision, or decode a geohash back to its bounding box, centre point and error bounds in metres. Encoding also returns the eight neighbouring cells, which is what a caller needs to do proximity search over a geohash-indexed store without a spatial database.
Output (data): encode: geohash, precision, bbox {min_lat, min_lon, max_lat, max_lon}, center {lat, lon}, error_m {lat, lon}, neighbours {n, ne, e, se, s, sw, w, nw} (each string|null: null where the cell would lie beyond a pole). decode: the same without neighbours, plus cell_width_m, cell_height_m (metres on WGS-84). Neighbour cells that would lie beyond a pole are null; longitude wraps at the antimeridian.
Deterministic: identical input returns identical output, so the response is served with Cache-Control: private, max-age=31536000, immutable (the paying client may cache it indefinitely; shared caches must not, because the response is paid).
Price: $0.05 USDC per call (x402, Base). Route contract version 1.0.0. Docs: https://api.duoleads.com/docs#geo-geohash
Request
- Base URL: https://api.duoleads.com
- URL: https://api.duoleads.com/v1/geo/geohash
- Auth: none declared
Query parameters
encode (default): lat/lon to geohash. decode: geohash to bounding box. Accepted: encode, decode.
WGS-84 latitude, -90 to 90. Required when op=encode. Accepted: a number between -90 and 90.
WGS-84 longitude, -180 to 180. Required when op=encode. Accepted: a number between -180 and 180.
Geohash length 1-12, default 9 (about 4.8 m). Accepted: integer 1-12.
Geohash to decode, 1-12 characters. Required when op=decode. Accepted: base32 geohash alphabet, excluding a, i, l and o.
Response
Paid and settled. data is route-specific; a route that judges its input returns 200 with data.valid: false for a bad value.
Changes
No recorded changes to this operation across all 1 revision of this API.