Skip to content
oslew
Get a free key

APIs

Reverse geocoding API

A reverse geocoding API takes a coordinate and tells you what is there: the nearest addresses and places, ordered by distance, and the chain of administrative areas whose boundaries contain the point, from country down to neighbourhood and time zone. oslew answers both halves in one request, GET /v1/reverse, on the Address product. Every row carries its own licence code, because one answer mixes permissive address and place data with an administrative chain — divisions and time zone alike — under the ODbL.

Last reviewed

Reverse geocoding is the question a map pin, a GPS fix or a photo’s metadata asks: I have a position, so what is it? The honest answer has two parts that come from different data, and most integration mistakes come from reading one as if it were the other. oslew returns both, labelled, in one response from GET /v1/reverse.

One request, two answers

You send a single parameter that matters, at, as latitude then longitude, and optionally limit, which defaults to a handful and is capped at 50 results. There is deliberately no radius and no filter by kind. Reverse returns whatever is nearest, whether that is a numbered address, a street row or a named place.

  • results is the list of nearby records, nearest first, each with distance_m from your point.
  • admin is every administrative division whose boundary contains the point, outermost first: country, region, county, locality, neighbourhood and the time zone.

When you want the nearest thing of one kind — the nearest pharmacy, the nearest café — use nearby places search, which filters by category and belongs to the Search product. Reverse is for “what is here”, not “where is the nearest one of these”.

Reading a list that mixes addresses and places

The results interleave two layers, so a museum and the address point next door can sit side by side. The precision field on each row says which kind it is: poi for a place, whose category is in its hierarchy; rooftop for an address point carrying a house number as its source recorded it; street for an address row that names a street but no number; address for a row with neither.

Reverse carries no calibrated confidence, no tie count and no explanation of a match, because nothing was matched. The ordering is geometry. That moves the judgement to you, and the right rule depends on what the coordinate is for:

  • A postal address for a pin: take the nearest numbered address point, and only if its distance is within what you would call “at” in that setting. In a dense city a few dozen metres can be a different building.
  • The place someone is standing in: take the nearest place and check its category against what you expect, since a fix on a pavement can be closest to a shop sign rather than the venue it belongs to.
  • Only the area: ignore the list and read the chain.

Distances are measured to the centre of a fine grid cell a few metres across, so two records almost on top of each other can swap order, and a tiny distance simply means “here”.

admin and hierarchy are not the same thing

Every result also carries a hierarchy: the locality, region and country that the row’s own source wrote down, plus a category for a place or a street and postcode for an address. It is carried, not looked up, and parts of it are often empty because many address sources record no region at all.

The top-level admin chain is different in kind. It is computed for your point from boundary polygons, and each entry carries the division’s identifier, its ISO codes where it has them, and via, which says whether the point’s cell sat wholly inside the polygon or straddled an edge so that the geometry itself decided. When the two disagree — a row that spells its region as a short code while the chain gives the full ISO 3166-2 form — both are right about what they describe. Use the chain for “which municipality is this coordinate in”; use a row’s hierarchy to display that row the way its source names it.

Two details catch people out. A country can appear twice, once from the land divisions and once from the maritime layer, so pick an entry by its subtype and source rather than taking the first of a kind. And where no divisions are loaded for the area, the chain is an empty list, not an error. Polygons, containment tests and the division types themselves are covered on the boundaries API page.

Licences differ inside one response

This is the part of reverse geocoding that matters most to a legal review, and it is why the licence code sits on each row rather than on the endpoint:

  • Places come from CDLA-Permissive-2.0 data.
  • Address points come from many public sources, each permissive and each named upstream, so their code reads permissive (per-source, see record).
  • The divisions in the chain are ODbL-1.0, the licence Overture publishes its Divisions theme under. The code the API writes on these rows currently reads CDLA-Permissive-2.0, which disagrees with Overture, and Overture’s published licence is the one that applies.
  • The time-zone entry of the chain comes from timezone-boundary-builder, derived from OpenStreetMap, under ODbL-1.0.

So a single reverse answer splits in two: the nearby addresses and places may be kept without share-alike, while every entry of the admin chain carries share-alike if you publish a database built from it. The time-zone entry names the zone and nothing more; for its offset from UTC at a given moment, the time zone API answers from the same polygons. Store the licence code beside every row you keep, and read the licensing page for what each code asks of you.

How far the search reaches

The search starts in the few hundred metres around the point and widens a level at a time until it holds enough records that are certainly nearer than anything outside. In a city, the answer comes from the immediate neighbourhood. In the countryside it keeps widening, as far as a city-sized cell, about 10 km across. A point with nothing inside that reach — open water, empty desert — returns an empty list with a success status, which is an answer rather than a failure. At the widest step the list is the best that cell holds, which may miss something just beyond its edge.

What is kept about the point you asked about

A reverse request is, among other things, a precise location, often a person’s. The query log is designed so that it cannot hold one. Positions are kept only as the level-12 cell they fall in, about 2 km across. The same cell treatment applies to the top result’s position, and the event records no IP address and no key. The security page lists every field the log holds and the ones it has no room for.

What it costs

Reverse geocoding is part of the Address product, so it runs on every plan, Free included, where the rate is 1 requests a second sustained, burst 5. On the Address plan, $99 a month buys 20 requests a second sustained, burst 100. One reverse lookup takes one token from the key’s address bucket, the same bucket forward geocoding draws on. There is no count of lookups to run out of; going faster than the rate returns HTTP 429 with a Retry-After header.

Limits worth knowing

  • No radius, no category filter and no confidence. Choosing between the nearest records is the caller’s job.
  • Coverage is whatever address, place and division data is loaded for the area; where places are sparse, the nearest record can be far away, and distance_m is there so you can refuse it.
  • The time-zone entry has no offsets. The admin chain is not the permissive part of the answer either: its divisions and its time zone are both ODbL, whatever the division rows’ code currently says.
  • Coordinates are latitude first. A longitude-first pair lands somewhere else or is refused.

Bottom line

Use reverse geocoding when you hold a coordinate and need an address, a place or an area for it. Read precision and distance_m before trusting the first row, read admin rather than a row’s hierarchy for jurisdiction, and keep the licence code with anything you store — only the nearby addresses and places are permissive, and the whole admin chain is ODbL.

Questions

What does a reverse geocoding API return?

Two things. A list of the nearest records to the point — street addresses and named places mixed together, nearest first, each with its distance — and the chain of administrative divisions whose polygons contain the point, including the time zone. The first says what is near; the second says which country, region, municipality and zone the point is in.

Why is there no confidence score on a reverse geocode?

Nothing was matched against text, so there is nothing to be unsure about in the ranking. The order is a measured distance from your point to each record. The judgement left to you is which of the nearest records you mean — the nearest numbered address, the nearest place, or only the area.

Can I store reverse geocoding results?

Addresses and places come from permissively licensed data and may be kept without share-alike. The administrative chain — every division and the time-zone entry — comes from ODbL data: you may store it too, with attribution, but a database of those entries that you share must be offered under the ODbL. Read each row’s licence code rather than assuming one for the whole answer, bearing in mind that the division rows’ code currently reads CDLA-Permissive-2.0 where Overture publishes the ODbL.

Is the coordinate I send logged?

The query log’s event has no field for an IP address, an API key, the text of a query or a precise coordinate, so none of them can be written. Positions are kept only as the level-12 cell they fall in, about 2 km across. So a reverse lookup leaves a neighbourhood-sized cell in the log, never the point you sent.

Which order does the coordinate go in?

Latitude first, then longitude, as the at parameter: at=19.4406,-99.2047. GeoJSON and several map libraries write longitude first; a pair copied from them without swapping lands somewhere else entirely, or is refused as out of range.

Browse every page →