Nearest Address
The Nearest API suggests partial address results for a given latitude and longitude. This is also known as reverse geocoding.
Step 1.Request
GET POST https://api.getAddress.io/nearest/{latitude}/{longitude}?api-key={api-key}
Response
{ "suggestions": [ { "distance": 0.1, "address": "Westminster Gallery, Westminster Central Hall, Westminster, London", "url": "/get/NDg5YmQ5NzY5Zjk0YmI5IDUxMTQ3MTI1", "id": "NDg5YmQ5NzY5Zjk0YmI5IDUxMTQ3MTI1" } ] }Step 2.
The selected 'Id' is passed to the 'Get' API to return the full address.
Request
GET https://api.getAddress.io/get/{id}?api-key={api-key}
Response
{ "postcode": "NN1 3ER", "latitude": 52.24593734741211, "longitude": -0.891636312007904, "formatted_address": [ "10 Watkin Terrace", "", "", "Northampton", "Northamptonshire" ], "thoroughfare": "Watkin Terrace", "building_name": "", "sub_building_name": "", "sub_building_number": "", "building_number": "10", "line_1": "10 Watkin Terrace", "line_2": "", "line_3": "", "line_4": "", "locality": "", "town_or_city": "Northampton", "county": "Northamptonshire", "district": "Northampton", "country": "England" "residential": true }
Filter
A filter limits results to specific criteria.
Request
{ "filter": { "residential":{true or false} } }
Optional Parameters
Property | Default | Description | Type |
---|---|---|---|
top | 1 | Sets the number of suggestions to retrieve (max 20) | Text |
template | {formatted_address} | Address template, available fields: {formatted_address}, {outcode}, {line_1}, {line_2}, {line_3}, {line_4}, {town_or_city}, {locality}, {county}, {country} |
Text |
term | Optional search term. | Text | |
radius | 0.2 | Search radius, in kilometers, from the given location (max 1) | Number |