Reverse Geocoding API
Send a latitude and longitude and get the nearest address, with the street, city, region, postcode and country broken out, plus how far the address is from the point you sent. Ask for a coarser answer with level when you only want the city or the country.
Example
$ curl "https://api.mygeocode.com/v1/reverse?lat=48.8584&lon=2.2945"The point is a few metres from the Eiffel Tower's base. The response is the nearest postal address, and distance_m tells you it is 12 metres away. If the nearest address were 400 metres away, say from a point in a park, you would see that too and could decide to show the district instead.
Add level=city to skip the address and get the locality directly, or level=country for a fast country lookup.
{
"status": "ok",
"lat": 48.8584,
"lon": 2.2945,
"result": {
"formatted": "5 Avenue Anatole France, 75007 Paris, France",
"lat": 48.85837,
"lon": 2.29448,
"distance_m": 12,
"type": "address",
"precision": "house",
"components": {
"house_number": "5",
"road": "Avenue Anatole France",
"suburb": "7th Arrondissement",
"city": "Paris",
"state": "Ile-de-France",
"postcode": "75007",
"country": "France",
"country_code": "fr"
}
}
}What you get back
| Field | Meaning |
|---|---|
result.formatted | The nearest address in that country's format. |
result.lat, result.lon | The position of the address itself, not the point you sent. |
result.distance_m | Metres between your point and the address. A large number means you are not really at an address. |
result.precision | house, street, postcode or admin, depending on what exists near the point in that country. |
result.components | Address parts with the same keys as forward geocoding. |
result is null | Nothing within 5 km of the point. Open ocean, Antarctica. The status is still ok. |
Where it is used
Labelling GPS points
Turn a device's location into "near 5 Avenue Anatole France" for a log, a receipt or a photo caption. Use distance_m to switch between "at" and "near".
Local defaults
Pre-fill a country, currency or language from the visitor's location with level=country. Pair with IP lookup when you do not have coordinates.
Delivery and field work
Convert where a driver actually stopped into an address and compare it with where the order said to go.
Price and limits
One call, one request. 2,500 a day free per IP without a key; then credits at $0.001 per request or €50 a month unlimited. Pricing. Drop-in hosts answer reverse requests in the Google, Nominatim, Mapbox and other formats.