Reverse geocode

To find the nearest address to specific geo-coordinates, you can submit a request to the Reverse Geocode endpoint, revgeocode.

The Reverse Geocoder responds with nearby point-type features address, place, or a nearby point on a street segment based on input geo-coordinates. The Reverse Geocoder sorts the results by distance from the input point. If no point-type features are nearby, the Reverse Geocoder falls back to area matches at the input point. For Japan, the Reverse Geocoder also responds with sub-block and block point-type features.

Canada, Ireland, Israel, the Netherlands, Singapore, and the United Kingdom have precise postal codes that do not describe an area but are associated with a few or even a single address. The Reverse Geocoder responds with postal-code-point features for these countries if no address is nearby.

For example, a user selects a point on a map in Vienna, and submits the map geo-coordinates in a request to the revgeocode endpoint.

GET https://revgeocode.search.hereapi.com/v1/
    revgeocode
    ?at=48.2181679%2C16.3899064
    &lang=en-US
    &apiKey={YOUR_API_KEY}

For this example, the API returns the nearest address, "Heinestraße 42, 1020 Vienna, Austria". The response to the above request looks like below. Notice the distance (in meters) from the input geo-coordinates to the result.

{
  "items": [
    {
      "title": "Heinestraße 42, 1020 Vienna, Austria",
      "id": "here:af:streetsection:2VFm4oq5Zq8utAoSB90pmA:CgcIBCD6iaNNEAEaAjQy",
      "resultType": "houseNumber",
      "houseNumberType": "PA",
      "address": {
        "label": "Heinestraße 42, 1020 Vienna, Austria",
        "countryCode": "AUT",
        "countryName": "Austria",
        "state": "Vienna",
        "county": "Vienna",
        "city": "Vienna",
        "district": "2. Bezirk-Leopoldstadt",
        "street": "Heinestraße",
        "postalCode": "1020",
        "houseNumber": "42"
      },
      "position": {
        "lat": 48.21809,
        "lng": 16.38988
      },
      "access": [
        {
          "lat": 48.21815,
          "lng": 16.38995
        }
      ],
      "distance": 4,
      "mapView": {
        "west": 16.39157,
        "south": 48.21697,
        "east": 16.38819,
        "north": 48.21921
      }
    }
  ]
}

The response includes geo-coordinates of the address and complete postal address string with correct postal code.

It delivers the following high-level elements for each result:

  • resultType - HERE Geocoding and Search /revgeocode is able to return items of several types: houseNumber, place, locality, street, etc.
  • houseNumberType - type of address data (returned only for address results):
    • PA - Point Address, location matches as individual point object
    • interpolated - location is the interpolated point on an address range line object
  • title – a representative string for the result. In case of address it is the complete postal address string
  • address - the detailed address of the result
  • position - a representative geo-position (WGS 84) of the result. This is to be used to display the result on a map
  • access - the geo-position of the access to the result (for instance the entrance)
  • mapView - bounding box of the location optimized for display
  • distance - the /revgeocode endpoint returns the distance in meters to the given spatial context ('at=lat,lon')
  • id - the identifier of the result object. Its value can be used to retrieve the very same object through the /lookup endpoint.

More details about /revgeocode parameters can be found in the API Reference.

results matching ""

    No results matching ""