Skip to content
oslew
Get a free key

Switching guide

How to migrate from Nominatim

Moving a Nominatim client to oslew starts with a host change: oslew serves Nominatim’s /search and /reverse at a compatibility path, in the jsonv2 and json formats, with oslew’s own data inside. Add an API key in an Authorization header, stop relying on OpenStreetMap identifiers, which come back null, and replace countrycodes and zoom, which are not read. Then test on addresses whose positions you know and move call sites to the native geocoder at your own pace.

Last reviewed

Two kinds of team move off Nominatim. Some have outgrown the public server and need production capacity; others run their own instance and would rather not. The mechanics are the same for both: oslew answers Nominatim-shaped requests at a compatibility path, and most of the work is in the handful of fields that deliberately differ.

Why the public server is the wrong home for production

The OpenStreetMap Foundation’s public instance runs on donated machines and says plainly that it is not for heavy use. Its policy sets a low absolute ceiling on requests, counted across every user of an application at once, so a busy server-side feature shares one small allowance. Search-as-you-type is banned outright, scheduled and bulk jobs are held to a much slower pace, and services built around geocoding are told to run their own instance. The policy can also change without notice, and it warns commercial users to bear that in mind. None of that is unreasonable for donated hardware; it is incompatible with an application people pay for. The exact wording, quoted and dated, is on the Nominatim comparison.

If you already run Nominatim yourself, the policy is not your reason to move. The reason is operational: the imports, the updates, the database sizing and the on-call duty that come with a self-hosted geocoder.

What your parser will notice

Most of the response is familiar. Search returns an array, reverse returns one object, and coordinates stay as strings in lat and lon. The differences a parser meets are these:

  • importance is oslew’s calibrated confidence on forward lookups and zero on reverse ones. Sorting by it still works; a threshold chosen on Nominatim’s values will not.
  • type describes the kind of result in a small vocabulary — house, road, postcode, city, state, country, or yes for a place — and with jsonv2, category is always place. Code that branches on OpenStreetMap class and type values will not find them.
  • place_rank is coarse: one value for an address or a place, others for a street, a postcode, a city, a region and a country.
  • boundingbox is an error bar around the point, four strings reaching its estimated error either side, not the outline of the feature.
  • address holds only house number, road, city, state, postcode and country code, each only when known. Code that expects keys such as suburb or county must tolerate their absence.
  • precision_m and provenance are added to every result, and a reverse answer adds distance_m from the point you sent.

The licence field and your attribution

licence names oslew’s licence code and dataset, and that has a consequence beyond parsing. If your interface prints the licence string, or an OpenStreetMap attribution because Nominatim’s answers were OpenStreetMap data, the attribution now has to follow what oslew returned. Address and place results are permissive; administrative boundaries, time zones and anything derived from roads are ODbL. The licensing page lists every layer and the attribution each needs.

Replacing what countrycodes and zoom did

A country filter becomes query context: put the country name or its ISO code after the last comma of q, where it is resolved before scoring. Only one piece of context is read, so a request that allowed several countries has to become one request per country, or one unfiltered request whose address.country_code your code checks.

A coarse zoom on reverse asked for an area rather than an address. The compatibility path always answers with the nearest address or place. The native reverse geocoding route answers both questions at once: the nearest things to the point, and the chain of administrative areas that contain it, from country down to neighbourhood.

Throttles, rates and bulk jobs

A client written for the public server usually sleeps between requests. On oslew that pause is wasted time. Each key has one token bucket per product, with a sustained rate and a burst, and there is no monthly quota. Send as fast as your plan allows, and when a request comes back as HTTP 429, wait the whole seconds its Retry-After header gives and carry on. Nightly jobs over a table of addresses no longer need to be trickled: batch geocoding takes an uploaded file and works through it at the plan’s rate.

Testing the switch

Pick a sample of addresses whose positions you know independently, not ones you geocoded with Nominatim in the first place, and run them through your current setup and through oslew. Record the distance from the truth, empty answers, and the precision_m oslew reports. Repeat the exercise for reverse lookups with points whose correct address you know. Disagreements that cluster by district or address format usually point at input to clean up rather than at either geocoder.

Moving to the native API

GET /v1/geocode returns coordinates as numbers, a normalised address, a precision level with an error radius, a calibrated confidence and tied_at_top, the number of candidates that tied for first. The compatibility shape has no room for that last field, and it is the one that tells you when a query named more than one place. Move call sites when you want it; the compatibility path can stay in place until then.

Bottom line

Change the host, add a key header, drop any dependence on OpenStreetMap identifiers and parse the formats oslew answers. Rebuild country filtering as query context, take the throttle out, and test on known positions before switching traffic.

Moving from Nominatim, step by step

  1. 1. Find every Nominatim call and the format it asks for

    List the call sites that hit /search or /reverse, on the public server or on an instance of your own, and note the format each requests, or, where none is sent, the format its parser expects. jsonv2 and json carry over unchanged, and oslew answers jsonv2 when no format is sent; a client that asks for or expects geojson or xml needs its parser changed before it can move.

  2. 2. Ask /v1/migrate what carries over

    Paste one request URL into /v1/migrate, which needs no key. It recognises Nominatim by its host or by a path ending in /search or /reverse, lists each parameter with whether it carries over and why, and writes the compatibility and native requests. It prices nothing, because the public server is not sold.

  3. 3. Create a key and send it as a header

    The public server asks callers to identify themselves rather than to authenticate; oslew needs a key. Create one in the console and send it as Authorization: Bearer from your server. Keys are never read from the URL, and a browser cannot call the service directly.

  4. 4. Point the host at the compatibility path

    Rewrite the base so that /search becomes https://api.oslew.com/compat/nominatim/search and /reverse becomes https://api.oslew.com/compat/nominatim/reverse, keeping q, lat, lon, format and limit as they are.

  5. 5. Stop relying on OpenStreetMap identifiers

    osm_type and osm_id come back null, and place_id is not durable. Anything that joins results to OSM objects, or stores place_id as a key, needs a different join: the coordinates plus the normalised address, with the provenance stored beside them.

  6. 6. Replace countrycodes and zoom

    Write the country’s name or ISO code after the last comma of q instead of sending countrycodes. Where a reverse call used a coarse zoom to get a town or region, read the administrative areas the native /v1/reverse returns for the point.

  7. 7. Remove the throttle, then test on known places

    The pause your client inserts to stay within the public policy can go; pace by your plan’s rate and Retry-After instead. Then run addresses with known positions through your current setup and through oslew, and compare distances before moving traffic.

  8. 8. Move call sites to /v1/geocode

    The native route returns lat and lon as numbers, a calibrated confidence with the tie count it depends on, and up to 50 results per request. Move one call site at a time, starting with the one where a wrong answer costs most.

What the Nominatim search and reverse endpoint accepts

Served at GET /compat/nominatim/search, GET /compat/nominatim/reverse, returning at most 10 results. Parameters that carry over: q, lat, lon, format, limit.

ParameterWhat happens to it
addressdetailsIgnored: accepted and ignored: the address object is always included.
countrycodesIgnored: filtering is by administrative name, not by ISO code.
zoomIgnored: not read: a reverse answer is the nearest address or place.
  • format is jsonv2 (the default) or json; geojson and xml are refused with a 400.
  • limit on /search defaults to 10, at most 10; /reverse answers one object, and {"error": "Unable to geocode"} with a 200 when nothing is near.
  • licence carries oslew’s licence code and dataset, not OpenStreetMap’s; osm_type and osm_id are null.
  • lat and lon are strings, as this family writes them.

Should you switch at all?

This page is about how. Whether the move is worth making — price, data, licence, and where Nominatim is the better choice — is on the oslew vs Nominatim for production traffic page.

Questions

Do I need an API key to use oslew’s Nominatim-compatible endpoint?

Yes. Unlike the public Nominatim server, every oslew route except the health check, the OpenAPI document and the migration checker needs a key, sent in the Authorization header. The Free plan’s key is enough to build and test the switch.

Why are osm_type and osm_id null in oslew’s answers?

Because the data is not OpenStreetMap’s. oslew’s addresses and places come from Overture Maps releases, so there is no genuine OSM object to name, and an invented one would make your records impossible to reconcile with the real map. Join on coordinates and the normalised address instead.

Can I still request GeoJSON or XML?

No. The endpoint answers jsonv2, the default, or json, and refuses geojson and xml with a 400 rather than answering in a shape you did not ask for. A client that relied on either needs to parse the JSON array instead.

What should I show as attribution after switching from Nominatim?

Whatever the licence field on the results you display names. It carries oslew’s licence code and dataset, not OpenStreetMap’s, and most address and place answers are permissive. Boundary, time-zone and road-derived answers are ODbL and need the attribution that licence requires.

Browse every page →