Skip to content
oslew
Get a free key

APIs

Administrative boundaries API

An administrative boundaries API tells you which governed areas contain a coordinate. oslew’s /v1/admin takes one lat,lon and lists every division whose polygon holds it — country, region, county, locality and the neighbourhoods inside it, outermost first — with ISO country and region codes and the Overture id to key on. Overture publishes the divisions under ODbL-1.0, so the chain may be stored beside your own records, with attribution, and share-alike applies to any database built from it that you share. /v1/here returns the same chain together with everything else loaded at the point.

Last reviewed

Ask GET /v1/admin?at=19.4326,-99.1332 and the answer is a list, not a single place. The Zócalo in Mexico City sits inside a country, a federal entity, a borough, a city, a neighbourhood and a named plaza, and every one of those is a row, sorted from the largest to the smallest. There is no text to parse and nothing to rank: a point is inside a polygon or it is not, so the answer does not come with a confidence score or a tie count.

What the chain contains

Each entry has a subtype, and the list is ordered by it: country, dependency, region, county, localadmin, locality, then macrohood, neighborhood and microhood. The subtypes are Overture’s, and how a nation’s own tiers map onto them is not uniform. Mexico City’s boroughs arrive as county; somewhere else the municipality may be a localadmin or a locality. Before building logic on one subtype, look at a sample of points in the countries you serve.

Two assumptions break often enough to design against. The first is one entry per subtype: where two divisions of the same kind overlap, both are listed, and the Zócalo’s chain names Mexico twice. The second is that admin_level is a reliable tier number. It is filled only where the source provides one, so branch on subtype instead.

Codes and ids you can key on

Names are for display. For joins, filters and group-bys, every entry offers three better handles:

Field Holds Use it for
country The two-letter ISO 3166-1 code Country rules, currency, shipping zones
region The full ISO 3166-2 code, prefix included, such as MX-CMX State or province rules and reporting
id The division’s Overture id Anything below region level, where there is no ISO code

The region spelling differs between routes, and that catches integrations out. /v1/admin always carries the prefixed code. A geocoding result’s hierarchy.region holds whatever that address row recorded, which for the same area may be the bare CMX, and many address sources record no region at all. When you need a reliable code, compute it from the point rather than reading it from a row: that is the job this endpoint exists for. The reverse geocoding API returns the same computed chain beside the nearest addresses.

Inside, or near an edge

Every entry says how it was decided, in via. Each division is covered by cells when the layer is built. When the point’s cell lies wholly within a division, the answer is interior, reached without reading any geometry. When the division’s edge passes through that cell, the polygon itself is tested and the answer is boundary.

Both are exact for the coordinate you sent. What boundary adds is a warning that the point sits close to a line. If the coordinate is uncertain — a geocode with a wide precision estimate, a phone’s position, a Wi-Fi fix with a large accuracy radius — then a boundary entry is exactly where that uncertainty could put the true location on the other side. Coarse divisions use coarse cells, so a country-level boundary flag covers a wider band than a neighbourhood-level one. An interior entry does not say how far the edge is, only that it is not in the point’s cell.

Maritime zones in the same answer

The chain draws on the maritime divisions as well as the land ones. A maritime zone here is the country’s whole claim — land plus territorial sea — so even an inland point returns it, from overture-divisions-maritime, with its own provenance to tell it apart from the land entry of the same name. It is not an exclusive economic zone, which reaches much further out and is not in this layer. The same polygons drive the zone entries and exits in the vessel tracking API. A point in the open ocean, beyond every zone, answers with an empty list and status 200.

The time-zone row and its own source

/v1/admin also returns one row that is not an administrative area: the IANA time zone at the point, as subtype timezone, with the zone id in both id and name. It comes from timezone-boundary-builder rather than Overture, and is licensed ODbL-1.0; the land and maritime divisions are ODbL-1.0 as well, because that is the licence Overture publishes its Divisions theme under. One code disagrees with its publisher: on division entries provenance.license currently reads CDLA-Permissive-2.0, and Overture’s published ODbL is the licence that applies. If you are storing chains in bulk, treat every row as share-alike data and keep provenance.name per entry, because attribution names each source. Offsets and daylight-saving rules for an instant are on the time zone API.

One call for everything at a point

GET /v1/here?at=lat,lon puts the chain beside every other layer the deployment has loaded: the time zone as a separate field, the nearest addresses and places, the closest road on the driving network, the value of each raster including elevation, the latest station readings nearby and any transit stops in range. It is still a single request against the rate, however many layers reply.

The trade is size against precision of intent. /v1/here does all of that work on every call, so a page that shows only a municipality name is better served by /v1/admin. And because a missing layer simply contributes an empty field, stops: [] cannot tell you whether there are no stops or no transit data; the dedicated endpoint answers that question with an error that names the missing layer. The point enrichment use case walks through /v1/here over a table of coordinates.

Not a tax district

Administrative polygons describe government, not taxation. Sales-tax and VAT rules are usually set by nation, region and sometimes municipality, and this chain gives the codes to look a rate up by. Where a tax authority draws special districts — transit levies, special economic zones, local surcharges — those lines are not in the divisions data, and no amount of care with this endpoint will produce them. Treat a boundary entry at a coordinate you are unsure of as a case for review rather than an automated answer.

What it costs

/v1/admin and /v1/here belong to the Platform product. The Platform plan is $699 a month for 20 requests a second sustained, burst 100, and Scale raises that to 100 requests a second sustained, burst 300, with no monthly quota on either. A key on the cheaper plans can still get the chain: reverse geocoding is in the Address product and includes it. The pricing page lists which products each plan carries.

Limits worth knowing

  • The answer carries no geometry. It tells you which divisions contain the point, not their shapes.
  • It is point-only. Going from a name such as a region or a city to a division is what the context after the last comma in a geocoding query does.
  • Coverage is whatever divisions layer the deployment has loaded. With none loaded, /v1/admin answers an empty list with layers at zero rather than an error, so check that count before reading an empty chain as open sea.
  • The division polygons are Overture’s release, not a legal gazette. Boundary changes arrive with a new data release, and provenance.release names which one answered.

Bottom line

Use /v1/admin when a coordinate needs a country, region or municipality code you can join on, and read via before trusting an answer for a point you are unsure of. Use /v1/here when the same record also needs a time zone, terrain or the nearest road. Store the chain where it is useful, attribute Overture and timezone-boundary-builder, and read the licensing page before sharing any database built from it, because the ODbL’s share-alike reaches every row.

Questions

How do I get the ISO region code for a latitude and longitude?

Call /v1/admin with the coordinate and read the entry whose subtype is region. Its region field is the full ISO 3166-2 code with the country prefix, such as MX-CMX, and the country entry carries the two-letter ISO 3166-1 code. Key on those codes or on the division id, never on the name, because names repeat across levels.

Does the boundaries API return the polygons themselves?

No. It answers which divisions contain a point, with their names, codes, ids and licence, but not their geometry. To draw boundary lines on a map, the oslew basemap’s vector tiles carry an administrative boundary layer with a flag for maritime lines.

Can I use administrative areas to decide sales tax or VAT?

Only as a starting point. The chain gives you the country, region and municipality codes that most tax rules are keyed by, but tax authorities often draw districts that do not follow administrative lines. Where a rate depends on such a district, you need the authority’s own boundaries, and a point flagged as near an edge deserves a manual check.

Can I store the administrative chain I get back?

Yes, on the ODbL’s terms. Overture publishes land divisions and maritime zones under ODbL-1.0, which lets you keep them in your own database and use them commercially, provided you attribute the source. If you publicly share a database derived from them, that database must be offered under the ODbL too. The time-zone entry inside /v1/admin comes from timezone-boundary-builder under ODbL-1.0, so the whole chain carries the same obligations.

What is the difference between /v1/admin and /v1/here?

/v1/admin answers the chain alone and is the smallest, quickest call. /v1/here asks every loaded layer about the point at once — divisions, time zone, nearest places and road, rasters, station readings and transit stops — and suits a record that needs several of those in one request.

Browse every page →