Reverse geocoding guide

How to Convert Latitude and Longitude to an Address

Take GPS coordinates and turn them into a human-readable address with a reverse geocoding API.

What is reverse geocoding?

Reverse geocoding is the opposite of geocoding. Instead of starting with an address and finding coordinates, you start with latitude and longitude and find the address or place nearest to that point.

1. Send latitude and longitude

Pass the coordinates as lat and lon. Both are required, in decimal degrees (latitude −90 to 90, longitude −180 to 180). Use limit to request several candidates.

API

A complete reverse geocoding request

GET /v1/reverse?lat=51.5033635&lon=-0.1276248&limit=5
cURL
curl -H "X-API-Key: YOUR_MAPSI_API_KEY" \
  "https://mapsi.dev/v1/reverse?lat=51.5033635&lon=-0.1276248&limit=5"
JavaScript
const response = await fetch(
  "https://mapsi.dev/v1/reverse?lat=51.5033635&lon=-0.1276248&limit=5",
  { headers: { "X-API-Key": "YOUR_MAPSI_API_KEY" } }
);

const data = await response.json();

console.log(data.results[0].formatted_address);
Python
import requests

response = requests.get(
    "https://mapsi.dev/v1/reverse",
    params={"lat": 51.5033635, "lon": -0.1276248, "limit": 5},
    headers={"X-API-Key": "YOUR_MAPSI_API_KEY"},
)

data = response.json()
print(data)
Example response
{
  "success": true,
  "results": [
    {
      "formatted_address": "10 Downing Street, London, England, United Kingdom",
      "house_number": "10",
      "street": "Downing Street",
      "city": "London",
      "region": "Greater London",
      "region_code": null,
      "postcode": "SW1A 2AA",
      "country_code": "GB",
      "country": "United Kingdom",
      "coordinates": {
        "lat": 51.50333,
        "lon": -0.127603
      },
      "confidence": 0.9,
      "accuracy": "point",
      "layer": "address",
      "source": "openstreetmap",
      "source_id": "relation/1879842"
    }
  ]
}

2. Read the formatted address

Each result includes a formatted_address, broken-down fields such as street, city, postcode and country_code, and the coordinates of the matched feature.

const address = data.results[0].formatted_address;

3. Handle approximate or missing results

GPS points do not always fall on an address. A point can be on a road, inside a park, in a building or in an area with sparse address data. Be prepared for a street-level match, several candidates or an empty result, and use layer and accuracy to decide how specific the match is.

Common applications

  • Showing a readable location for a GPS tracker
  • Turning delivery coordinates into addresses
  • Building vehicle trip histories
  • Displaying locations submitted by mobile apps
Try reverse geocoding interactively. Open the free tool →