Reverse geocoding
GET /v1/reverse answers two questions about a point at once: what is nearest to it, and which administrative areas contain it. The first is a list of places and addresses ordered by distance; the second is the chain of divisions whose polygons hold the point. They come from different data and say different things, and telling them apart is most of using this route well.
curl -G "https://api.oslew.com/v1/reverse" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'at=19.4406,-99.2047' \
--data-urlencode 'limit=3'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.reverse("19.4406,-99.2047", limit=3)import { Client } from "@oslew/client";
// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });
const answer = await client.reverse("19.4406,-99.2047", { limit: 3 });HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 298
ratelimit-reset: 1
{
"at": [
19.4406,
-99.2047
],
"admin": [
{
"doc": 2174,
"id": "7f1f3634-1218-43e7-9538-ac3d1f43fc1c",
"name": "México",
"subtype": "country",
"country": "MX",
"region": null,
"admin_level": null,
"via": "interior",
"provenance": {
"name": "overture-divisions",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 61,
"id": "0831989a-c65b-47db-802e-f930af64b9e4",
"name": "México",
"subtype": "country",
"country": "MX",
"region": null,
"admin_level": null,
"via": "interior",
"provenance": {
"name": "overture-divisions-maritime",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 1560,
"id": "bc8dbc34-544b-47c4-bdb1-d3f5ecfc6af7",
"name": "Ciudad de México",
"subtype": "region",
"country": "MX",
"region": "MX-CMX",
"admin_level": 1,
"via": "boundary",
"provenance": {
"name": "overture-divisions",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 1357,
"id": "f7ff371f-1662-496e-9413-54c1ff115318",
"name": "Miguel Hidalgo",
"subtype": "county",
"country": "MX",
"region": "MX-CMX",
"admin_level": 2,
"via": "boundary",
"provenance": {
"name": "overture-divisions",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 1522,
"id": "2b1d49e2-98ef-4665-b9f6-1ce96c9f015b",
"name": "Ciudad de México",
"subtype": "locality",
"country": "MX",
"region": "MX-CMX",
"admin_level": null,
"via": "boundary",
"provenance": {
"name": "overture-divisions",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 1349,
"id": "7b906a62-7024-45cf-bbfa-1618f4bb7b32",
"name": "Ampliación Granada",
"subtype": "neighborhood",
"country": "MX",
"region": "MX-CMX",
"admin_level": null,
"via": "boundary",
"provenance": {
"name": "overture-divisions",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
}
},
{
"doc": 147,
"id": "America/Mexico_City",
"name": "America/Mexico_City",
"subtype": "timezone",
"country": null,
"region": null,
"admin_level": null,
"via": "interior",
"provenance": {
"name": "timezone-boundary-builder",
"release": "2026d",
"license": "ODbL-1.0"
}
}
],
"results": [
{
"doc": 348329,
"name": "Museo Soumaya",
"lat": 19.44062110346353,
"lon": -99.20465953606559,
"distance_m": 4.848551852818172,
"precision": "poi",
"precision_m": 6.756173533775122,
"hierarchy": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"category": "museum",
"postcode": null,
"street": null
},
"normalized": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"formatted": "Museo Soumaya, Miguel Hidalgo, CMX, MX"
},
"provenance": {
"name": "overture-places",
"release": "2026-08-19.0",
"license": "CDLA-Permissive-2.0"
},
"attributes": {
"rating": null,
"reviews": 0,
"price": null,
"hours": [
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"photo": "https://commons.wikimedia.org/wiki/Special:FilePath/Museo_Soumaya%2C_Ciudad_de_M%C3%A9xico%2C_M%C3%A9xico%2C_2015-07-18%2C_DD_12.JPG",
"provenance": {
"name": "wikidata",
"release": "2026-11-23",
"license": "CC0; images under their Commons licences"
}
}
},
{
"doc": 348328,
"name": "Nuevo Polanco",
"lat": 19.440713171602745,
"lon": -99.20465953606559,
"distance_m": 13.280140073732118,
"precision": "poi",
"precision_m": 6.756173533775122,
"hierarchy": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"category": "real_estate_service",
"postcode": null,
"street": null
},
"normalized": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"formatted": "Nuevo Polanco, Miguel Hidalgo, CMX, MX"
},
"provenance": {
"name": "overture-places",
"release": "2026-08-19.0",
"license": "CDLA-Permissive-2.0"
},
"attributes": {
"rating": null,
"reviews": 0,
"price": null,
"hours": [
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
],
[
0,
0
]
],
"photo": "https://commons.wikimedia.org/wiki/Special:FilePath/Ext_06Museo_Soumaya_FREE_Fernando_Romero_EnterprisE_photo_by_Adam_Wiseman.jpg",
"provenance": {
"name": "wikidata",
"release": "2026-11-23",
"license": "CC0; images under their Commons licences"
}
}
},
{
"doc": 348327,
"name": "Slimlandia",
"lat": 19.44052023216659,
"lon": -99.20483262335881,
"distance_m": 16.494187463828435,
"precision": "poi",
"precision_m": 6.756173533775122,
"hierarchy": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"category": "arts_and_entertainment",
"postcode": null,
"street": null
},
"normalized": {
"locality": "Miguel Hidalgo",
"region": "CMX",
"country": "MX",
"formatted": "Slimlandia, Miguel Hidalgo, CMX, MX"
},
"provenance": {
"name": "overture-places",
"release": "2026-08-19.0",
"license": "CDLA-Permissive-2.0"
},
"attributes": null
}
],
"segments": 2,
"took_us": 2573
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
Parameters
| Parameter | Default | What it does |
|---|---|---|
at | required | lat,lon, latitude first, in decimal degrees. |
limit | 5 | Results returned, clamped to 1–50. |
That is all. There is no radius and no filter by kind: reverse returns what is nearest, whatever it is. For the nearest place of one kind — a pharmacy, a restaurant — use nearby places.
How far it looks
The search starts with the grid cell of about 300 m that holds the point and the eight cells around it. If that block holds limit results that are certainly nearer than anything outside it, those are the answer. If not, it steps up a level to cells twice the size, and again, as far as cells of about 10 km. So in a city the answer comes from the few hundred metres around the point; in the countryside it widens until it finds something; and a point with nothing within roughly ten kilometres — open water, an empty desert — answers 200 with an empty results. At that widest step the list is the best the block holds, which may not include something just beyond it.
distance_m is measured from your point to each result's position, which is the centre of a cell of about 7 m — so two results a few metres apart can swap order from what a survey would say, and adistance_m under 7 m means "here". Results are ordered by it, nearest first. Seecells and levels.
Places and addresses, together
The list mixes both layers — a museum and the address point next door can be neighbours in it — and each result says which it is through precision:
precision | The result is |
|---|---|
poi | A place: a museum, a shop, an office. hierarchy.category says what kind. |
rooftop | An address point with a house number, as its source recorded it. |
street | An address row that names a street but no number. |
address | An address row with neither. |
There is no confidence, no why and no tied_at_top. Nothing was matched against text, so there is nothing to be unsure about: the ranking is a distance, which is a measurement rather than a judgement. What is left to you is deciding which of the nearest things is the one you mean.
The nearest thing is not always the right thing
A GPS fix in a car park is nearest to the car park; a fix on a pavement may be nearest to a shop sign. Read more than one result and pick by what you need:
- A postal address for the point: the nearest result whose
precisionisrooftop, and check that itsdistance_mis within what you would call "at" — fifty metres is a different building in a city. - The place someone is at: the nearest
poi, with itshierarchy.categorychecked against what you expect. - Only the area: ignore
resultsand readadmin, below.
from oslew import Client
client = Client(base_url="https://api.oslew.com")
def postal_address(at: str, within_m: float = 30.0):
answer = client.reverse(at, limit=10)
for r in answer["results"]: # nearest first
if r["precision"] == "rooftop" and r["distance_m"] <= within_m:
return r["normalized"]["formatted"], r["provenance"]["license"]
return None # nothing numbered close enoughimport { Client } from "@oslew/client";
const client = new Client({ baseUrl: "https://api.oslew.com" });
async function postalAddress(at: string, withinM = 30) {
const answer = await client.reverse(at, { limit: 10 });
const hit = answer.results.find(
(r) => r.precision === "rooftop" && r.distance_m <= withinM, // nearest first
);
return hit ? { line: hit.normalized.formatted, license: hit.provenance.license } : null;
}admin and hierarchy are different things
The answer has two descriptions of "where", and they disagree on purpose.
admin, at the top level, is every division whose polygon contains your point, from the divisions layer: country, region, county, locality, neighbourhood, and the time zone. It is sorted outermost first — by kind of division, then by name — and each entry carries the division's own identifier, its ISO codes and how the containment was decided. In the answer above it says the point is in Mexico, in the regionMX-CMX, in the county Miguel Hidalgo, in the locality Ciudad de México, in the neighbourhood Ampliación Granada, and in the zone America/Mexico_City.
hierarchy, on each result, is what that row's own source recorded about it: a locality, a region, a country, and for a place its category, for an address its street and postcode. It is not looked up; it is carried. In the answer above, Museo Soumaya's row records its locality as Miguel Hidalgo and its region as CMX — where admin calls Miguel Hidalgo a county and writes the region MX-CMX. Both are right about what they describe. A row's parts may also benull: many address sources record no region.
admin (top level) | hierarchy (per result) | |
|---|---|---|
| Describes | Your point | The result |
| Comes from | Division polygons containing the point | The row's own source record |
| Region spelling | ISO 3166-2, MX-CMX | As the source wrote it, CMX |
| Includes the time zone | Yes, as a timezone entry | No |
| Use it for | Which municipality, region or country a coordinate is in; tax, jurisdiction, routing to a team | Displaying the result the way its source names it |
Three details of admin to handle:
- A division can appear once per layer. Above, the country appears twice, once from
overture-divisionsand once fromoverture-divisions-maritime, with differentids. Pick bysubtypeandprovenance.namerather than taking the first entry of a kind. viasays how containment was decided.interiormeans the point's cell is wholly inside the polygon, so no geometry was read;boundarymeans the cell straddles an edge and the polygon itself decided. A point metres from a border is answered by the polygon, not by the cell.- It depends on what divisions are loaded. Where none cover the point,
adminis an empty list, not an error.
The time zone entry names the zone and nothing else. For its offset at a given moment, usetime zones.
Provenance, per result
Each result carries provenance: {name, release, license} — the licence code is atprovenance.license, not a top-level license field. It is per result because one answer mixes sources: above, places come from overture-places under CDLA-Permissive-2.0, address points would come from overture-addresses with a licence that varies by source record, the divisions in admin and its time zone entry are ODbL-1.0. Where a place has ratings, hours or a photo, attributes carries them with a provenance of its own. If you store answers, store the licence code beside each row; data and licensing says what each one asks of you.
Reverse, or another route?
Several routes answer "what is here", each with a different emphasis and product:
| Route | Answers | Product | Use it when |
|---|---|---|---|
/v1/reverse | The nearest places and addresses, and the division chain | address | You need an address or place for a coordinate — a pin, a GPS fix, a photo's location. |
/v1/admin | The division chain alone | platform | You need only the area, on a plan with platform. The chain is the same one reverse returns in admin, so on an address plan, reverse gives it too. |
/v1/timezone | The zone and its offsets at a moment | address | You need local time, not just the zone's name. |
/v1/nearby | The nearest places of a category, optionally open at a time | search | You want the nearest pharmacy, not the nearest anything. Places only. |
/v1/here | Everything loaded at a point: divisions, zone, places, the nearest road, rasters, conditions, transit stops | platform | You are enriching a coordinate with every layer at once and would rather one request than six. |
Errors
A missing at is refused by the framework before the route runs, as plain text:Failed to deserialize query string: missing field `at`. A value that is not two numbers is400, near must be lat,lon, and one off the globe is near is out of range — the message says near whatever the parameter was called. A point with nothing nearby is not an error. See errors and conventions.