street of houses and coordinates

Introduction to Reverse Geocoding


A robust reverse geocoder is actually a combination of many tools. For one, there isn't a single geocoder that can solve the many uses of reverse geocoding. In addition, since reverse geocoders are built to help humans understand location, there are many factors that provide worldwide data in the format users expect.

What is Reverse Geocoding?

In a world of smartphones and Internet of Things devices, location data is all around us. The way computers understand a place is very different from humans. Latitude and longitude coordinates make sense to machines, but addresses and place names are how we interpret a location.
"Reverse geocoding is the process of converting GPS coordinates into human-readable placenames"
For example, let's say you pulled out your phone and opened your map application. The built-in GPS will find your location and plot it on the map. It knows where to put it based on the latitude and longitude coordinates it returns. The map helps you recognize your location. Otherwise you'd just have a couple numbers: lat,lon. A reverse geocoder takes those coordinates as input and determines a name for where you are. In fact, it may return several names:

  • Street Address
  • Landmark
  • City
  • Postal code
  • Country

Latitude and longitude is great for maps, but users often need more context. Reverse geocoders supply additional data to make geographic applications much more useful.

Forward vs Reverse Geocoding

Discussing this topic begs the question: what is the difference between forward and reverse geocoding? Certainly, they're related - in fact, opposites.

"Forward geocoding converts names
into machine-readable coordinates"

When most refer simply to geocoding, it's the forward variety they're referencing. Here you take addresses or other place names from a user or database and translate them into latitude/longitude pairs. Often, this happens immediately before placing them on a map.

This guide is focused exclusively on reverse geocoding because of the many common reverse geocoding use cases, from fleet tracking to payment processing. We'll explore the many exciting ways to reverse geocode in this guide.

First, let's see the typical way to use a reverse geocoder, via an API.

Calling a Reverse Geocoder API

While it's possible to build your own geocoder, it's more likely that you will call an existing geocoding API. You'll need to know a sample location, such as where you are right now, in coordinates to make the call.

An API call is simply a URL with the latitude/longitude pairs included in the query string:

Often, you'll also need to pass an API Key (the key parameter in the example above) to track the number of calls. This is used to determine whether you're within the API rate limit thresholds and often is tied to how much you will need to pay the API provider.

Here are the abbreviated JSON response from an example OpenCage geocoding API request for the coordinates 51.952659,7.632473

  "results": [
      "annotations": {
        "timezone": {
          "name": "Europe/Berlin",
          "now_in_dst": 1,
          "offset_sec": 7200,
          "offset_string": "+0200",
          "short_name": "CEST"
      "components": {
        "political_union": "European Union",
        "postcode": "48153",
        "road": "Friedrich-Ebert-Straße",
        "state": "North Rhine-Westphalia",
        "suburb": "Innenstadtring"
      "confidence": 10,
      "formatted": "Friedrich-Ebert-Straße 7, 48153 Münster, Germany",
  "status": {
    "code": 200,
    "message": "OK"
  "total_results": 1

The best way to get a feel for how a reverse geocoder works is to try a few different calls yourself.

Here's how you would call the OpenCage geocoding API using curl from the command line:

$ curl ',7.632473&pretty=1&key=YOUR-API-KEY'

Reverse Geocoding Demo

You can also see how sample API calls work using the OpenCage demo page. It includes some sample coordinates and a quick way to grab your own location from the browser.

Screenshot of the OpenCage geocoding API demo page
The OpenCage geocoding API demo page.

Reverse Geocoding in Software

While it's useful to see raw API requests and responses, most commonly you'll be integrating them into your applications. The easiest way to programmatically geocode is to use an SDK for the geocoding API.

For example, here's how you would call OpenCage using Python:

from opencage.geocoder import OpenCageGeocoder
key = 'YOUR-API-KEY'
geocoder = OpenCageGeocode(key)

reverse = geocoder.reverse_geocode(51.952659, 7.632473)

Look for your favorite programming language or tool in our list of over 30 different geocoding SDKs.

Choosing the Right Geocoder

Google Maps makes a popular geocoder, which includes reverse geocoding options. Google is a great option for hobbyist projects (which typically stay within its free tier). For high volume, business applications, Google's terms of service and the costs are often prohibitive.

What to consider when reverse geocoding without Google:

  • Terms that allow you to use the data without a Google Map (or without any map)
  • Pricing that is affordable to your enterprise use cases
  • Transparency into the data behind the geocoder
  • Frequency of data updates
  • Caching or storage policy: how long can you keep the data? Can you keep the data after you stop being a customer

In particular, OpenCage's Google alternative is built on open data like OpenStreetMap, which means the dataset is always improving.

Find out more about all the aspects to consider in our comprehensive guide to comparing geocoding services.

Need help with reverse geocoding?

At OpenCage we operate a highly-available, easy to use, affordable geocoding API built on open data, and used by hundreds of customers around the world. Learn more.