Geocode API

Getting geocode of an address: Geocode API

The /geocode endpoint provides the geographical coordinates of longitude and latitude for a given address. You can send multiple addresses in a request and get them converted into their corresponding latitude/longitude coordinates using this API.

These latitude/longitude coordinates can be used to pinpoint a place or position on a map. You can pass the location or the address in different formats including Place IDs and Plus Codes. As this API is concerned with the geographical latitudes and longitudes, additional address elements such as business names, unit, suite or floor numbers etc. should be avoided in the request.

The majority of the locations passed in the Geoservices API requests should be in the form of latitude and longitude coordinates. So you are likely to use this endpoint more often.

Mandatory parameters

  1. addresses: The addresses refers to the names of the location or a landmark that you want to convert to latitude/longitude coordinates. You can specify the local addresses of different countries as per the format used by the national postal service of the country.

Optional parameters

  1. language: Use the language parameter to return addresses in the given language. This must be defined in the form of a language code. Please refer to this list to find the code for different languages.

For example, let’s say you want to get the geocodes of Central Park, New York and Utah University in a single request. In this case, you can send a POST request by calling the /geocode endpoint with the following payload:

{
  "addresses": [
    "Central Park, New York",
    "The University of Utah, Utah"
  ],
  "language": "en"
}

This request returns the following geocode information:

{
    "result": [
        {
            "GeocodeSuccess": {
                "address": "Central Park, New York, NY, USA",
                "latlng": {
                    "lat": 40.7812199,
                    "lng": -73.9665138
                }
            }
        },
        {
            "GeocodeSuccess": {
                "address": "201 Presidents' Cir, Salt Lake City, UT 84112, USA",
                "latlng": {
                    "lat": 40.7649368,
                    "lng": -111.8421021
                }
            }
        }
    ]
}

From the response, you can see that the latitude and longitude coordinates of Central Park, New York, NY and the University of Utah, UT are 40.7812199, -73.9665138 and 40.7649368, -111.8421021 respectively.

For the schema information of this endpoint, please refer to /geocode.