Reverse Geocode
To find the nearest address to specific geocoordinates, you can submit a request to the Reverse Geocode endpoint, revgeocode.
For example, a user selects a point on a map in Vienna, and submits the map geocoordinates in a request to the revgeocode endpoint.
GET https://revgeocode.search.hereapi.com/v1/
revgeocode
?at=48.2181679%2C16.3899064
&lang=en-US
Bearer [your token]
The API returns the nearest address - "Heinestraße 42, 1020 Vienna, Austria", along with additional details included in the JSON result. Notice the distance (meters) 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.