Geocoding runs in two directions. Forward geocoding takes text, such as an address or a place name, and returns coordinates. Reverse geocoding takes a latitude and longitude and returns a description of what is there. It is tempting to treat them as exact inverses, but a round trip rarely lands where it started, and understanding why will save you from a class of subtle bugs. If you are new to the topic, start with what is geocoding.
Forward geocoding: text in, candidates out
A forward geocoder parses the query, searches an index of places and addresses, and returns a ranked list of candidates. Querying OpenStreetMap's Nominatim for Eiffel Tower, Paris returned, at the time of writing, the OSM way named "Tour Eiffel" at latitude 48.8582599, longitude 2.2945006, classified as man_made=tower, with a bounding box of roughly 175 m by 175 m and the address 5, Avenue Anatole France, 75007 Paris.
Three properties of forward geocoding matter in practice:
- It can return many answers. "Paris" matches the French capital, Paris in Texas and many smaller places. The geocoder ranks them, but your code decides whether to take the first result, show a list, or ask the user.
- It can return nothing. A misspelling, a new street or an unusual format can produce zero results, and your application needs a fallback.
- The point depends on the feature type. For a building you get a point on or near it; for a city you get a representative center that may be nowhere near the place your user meant.
Try it on any address with the address to coordinates tool, or compare the candidate list with place name search.
Reverse geocoding: the nearest suitable feature
Reverse geocoding does not compute an address for a coordinate. As the Nominatim reverse documentation puts it, it works by finding the closest suitable object in the database and returning that object's address. The answer is therefore whatever indexed feature happens to be nearest, and that is not always the one a human would choose.
Here is the worked example. We reverse geocoded 48.85837, 2.29448, a point beneath the Eiffel Tower about 12 m from the tower's own centroid. At the default, most detailed level (zoom=18) Nominatim returned an unnamed elevator feature just over 3 m away, whose address is Avenue Gustave Eiffel, 75007 Paris. The tower itself was not the answer, because a smaller feature was closer.
The same coordinate with zoom=10 returned the Paris administrative boundary instead, with a display name of "Paris, Île-de-France, France métropolitaine, France". Its reference point lies about 1.9 km from the query. Neither answer is wrong; they answer different questions:
| Nominatim zoom | Detail level |
|---|---|
| 3 | Country |
| 5 | State |
| 8 | County |
| 10 | City |
| 14 | Neighborhood |
| 16 | Major streets |
| 17 | Major and minor streets |
| 18 | Building (default) |
The lesson is to request the level of detail your feature actually needs. A weather widget wants a city; a delivery app wants a building. Asking for building-level detail and then trimming the address is fragile, because the nearest building-level feature may belong to a different street. You can experiment with the coordinates to address tool.
Typical use cases
Forward
- Placing customer, store or job addresses on a map.
- Converting an address typed into a form into coordinates for distance calculation or routing.
- Assigning records to sales territories or service areas.
- Search boxes that jump the map to a named place.
Reverse
- Showing "you are near…" for a phone's GPS fix.
- Labeling photos, vehicle positions or field visits with a readable location.
- Pre-filling an address form from the user's current position, with the user confirming it.
- Working out which city, region or country a coordinate falls in.
Accuracy pitfalls
The input coordinate is already uncertain. GPS.gov notes that GPS-enabled smartphones are typically accurate to within a 4.9 m (16 ft) radius under open sky, and that accuracy worsens near buildings, bridges and trees. In a dense city street the error can be much larger. A reverse geocoder treats the coordinate as exact, so input error passes straight through.
Snapping to the wrong side of the road. A few meters of error is enough to cross a street centerline. The nearest address may then be on the opposite side (with odd house numbers instead of even ones, in many numbering systems), or on a cross street when you are near a corner. If you know the vehicle's heading or the parcel the user is standing on, use it to check the result.
Precision truncation. Each decimal place of latitude is worth a factor of ten: four decimal places resolve about 11 m, five about 1.1 m. Rounding coordinates to three decimals before a reverse lookup (about 111 m in latitude) can move you to another block.
Round trips drift. Forward-geocode an address, reverse-geocode the result, and you will often get a neighboring building, a street-level address or a nearby point of interest. Store the original address alongside the coordinates instead of regenerating one from the other.
Caching and licensing
Whether you may store geocoding results depends on the data source, so read the terms before you design your database.
- Public Nominatim. The Nominatim usage policy sets an absolute maximum of 1 request per second, requires an identifying User-Agent or Referer, requires clients to cache results, discourages bulk geocoding, and forbids systematic queries such as reverse lookups on a grid.
- OpenStreetMap data. The OSM Foundation's geocoding guideline explains that individual results can be stored and combined with your own data, provided you are not systematically assembling a substantial copy of OSM, and that applications using an OSM-based geocoder must credit OpenStreetMap.
- Commercial services. Terms vary widely. Some limit how long coordinates may be cached, or require that results are displayed only on that provider's maps. Check before you persist anything.
OpenGeocoder's tools and JSON API are built on Nominatim data, cached on our server, rate-limited for fair use, and not intended for bulk geocoding. The geocoding API guide covers request patterns that stay within these limits.
Side-by-side comparison
| Forward geocoding | Reverse geocoding | |
|---|---|---|
| Input | Address, place name or postcode | Latitude and longitude |
| Output | Coordinates, bbox, structured address | Address of the nearest suitable feature |
| Number of results | Zero to many, ranked | Usually exactly one |
| Main difficulty | Parsing and ambiguity | Choosing the right feature and detail level |
| Main error source | Incomplete or ambiguous text | Inaccurate input coordinates |
| Key tuning control | Country and region filters | Zoom or detail level, feature layers |
| Typical use | Mapping addresses, routing, territories | Labeling GPS fixes, "near me", form pre-fill |
Key takeaways
- Forward geocoding searches text and can return many candidates or none; reverse geocoding returns the nearest suitable feature.
- Reverse results depend on the requested detail level: the same point under the Eiffel Tower gave an elevator on Avenue Gustave Eiffel at zoom 18 and "Paris" at zoom 10.
- Treat GPS input as uncertain by several meters and validate street side and corner cases.
- Store the original address with its coordinates, and check the data source's caching and attribution terms before persisting results.