Reverse geocoding

Coordinates in, the nearest address out, or the locality, region or country if that is all you want.

GEThttps://api.mygeocode.com/v1/reverse

Parameters

ParameterTypeDescription
latrequirednumber-90 to 90.
lonrequirednumber-180 to 180.
leveloptionalstringThe most specific level to return: address (default), street, postcode, city, region, country. Coarser levels are faster and never fall below the requested level.
radiusoptionalintegerSearch radius in metres for addresses, 1 to 5000. Default 5000. Set it small to get null instead of a far-away address.
langoptionalstringISO 639-1 code for names. Default en.
keyoptionalstringAPI key, if not sent as a header.

Example

$ curl "https://api.mygeocode.com/v1/reverse?lat=41.8902&lon=12.4922&lang=it"
const url = new URL("https://api.mygeocode.com/v1/reverse");
url.searchParams.set("lat", 41.8902);
url.searchParams.set("lon", 12.4922);
url.searchParams.set("lang", "it");

const { result } = await (await fetch(url)).json();
console.log(result ? result.formatted : "nothing nearby");
import requests

r = requests.get("https://api.mygeocode.com/v1/reverse",
                 params={"lat": 41.8902, "lon": 12.4922, "lang": "it"}, timeout=10)
result = r.json()["result"]
print(result["formatted"] if result else "nothing nearby")
Response
{
  "status": "ok",
  "lat": 41.8902,
  "lon": 12.4922,
  "result": {
    "formatted": "Piazza del Colosseo 1, 00184 Roma RM, Italia",
    "lat": 41.890251,
    "lon": 12.492373,
    "distance_m": 9,
    "type": "address",
    "precision": "house",
    "place_id": "it.addr.5d09aa31",
    "components": {
      "house_number": "1",
      "road": "Piazza del Colosseo",
      "suburb": "Municipio Roma I",
      "city": "Roma",
      "county": "Roma",
      "state": "Lazio",
      "postcode": "00184",
      "country": "Italia",
      "country_code": "it"
    }
  }
}

Response fields

FieldTypeDescription
lat, lonnumberThe point you sent, echoed.
resultobject or nullnull when nothing is within radius at the requested level.
result.formattedstringThe address, or the locality name for coarser levels.
result.lat, result.lonnumberThe position of the returned feature, not your point.
result.distance_mintegerMetres from your point to the feature. 0 when the point is inside it.
result.type, result.precision, result.place_id, result.componentsAs in forward geocoding.

Notes

The same lookup in other providers' formats

If you already have code written against one of these providers, keep it: the drop-in host accepts the same path and parameters and answers in that provider's response shape, with this endpoint behind it. See how the drop-ins work.

ProviderHostPath
Google Maps Platformgapi.mygeocode.com/maps/api/geocode/json?latlng=lat,lng
Bing Maps REST Servicesbing.mygeocode.com/REST/v1/Locations/{lat},{lon}
HERE Geocoding and Searchhere.mygeocode.com/v1/revgeocode?at=lat,lng
Mapbox Geocodingmapbox.mygeocode.com/geocoding/v5/mapbox.places/{lon},{lat}.json
/search/geocode/v6/reverse?longitude=...&latitude=...
Geocode.Farmfarm.mygeocode.com/reverse/?lat=...&lon=...
/v3/json/reverse/?lat=...&lon=...
OpenStreetMap Nominatimosm.mygeocode.com/reverse?lat=...&lon=...&format=json
OpenCageopencage.mygeocode.com/geocode/v1/json?q=lat,lng
LocationIQlocationiq.mygeocode.com/v1/reverse?lat=...&lon=...&format=json
Geoapifygeoapify.mygeocode.com/v1/geocode/reverse?lat=...&lon=...
TomTom Searchtomtom.mygeocode.com/search/2/reverseGeocode/{lat},{lon}.json
MapQuest Geocodingmapquest.mygeocode.com/geocoding/v1/reverse?location=lat,lng
Geocodiogeocodio.mygeocode.com/v1.7/reverse?q=lat,lng
PositionStackpositionstack.mygeocode.com/v1/reverse?query=lat,lng

Errors

400 invalid_request when lat or lon is missing or out of range, or level is not one of the listed values.