Nearest Location
The Nearest Location API suggests partial location results for a given latitude and longitude. This is also known as reverse geocoding.
Step 1.Request
GET POST https://api.getAddress.io/nearest-location/{latitude}/{longitude}?api-key={api-key}
Response
{
"suggestions":
[
{
"distance": 0.1,
"location": "Harold Hill, Romford, Essex",
"url": "/get-location/NDg5YmQ5NzY5Zjk0YmI5IDUxMTQ3MTI1",
"id": "NDg5YmQ5NzY5Zjk0YmI5IDUxMTQ3MTI1"
}
]
}
Step 2.
The selected 'Id' is passed to the 'Get-Location' API to return the full location.
Request
GET https://api.getAddress.io/get-location/{id}?api-key={api-key}
Response
{
"latitude": 51.6086605,
"longitude": 0.21630145,
"area": "Havering",
"town_or_city": "Romford",
"county": "Essex",
"country": "England",
"postcode": "RM3 7XL",
"outcode": "RM3"
}
Optional Parameters
| Property | Default | Description | Type |
|---|---|---|---|
| top | 1 | Sets the number of suggestions to retrieve (max 20) | Text |
| template | {area}{area,, }{town_or_city}{county,, }{county} |
Suggestion Text template. Available fields: {town_or_city}, {area}, {county}, {country} |
Text |
| term | Optional search term. | Text | |
| radius | 5 | Search radius, in kilometers, from the given location (max 20) | Number |