GET/v1/reverse
Nearest address to a coordinate
Reverse geocoding. The nearest address points within about 300 m, else the nearest street, else the containing place.
PARAMETERS
- latquery · numberREQUIRED
- Latitude in decimal degreese.g. 38.8977
- lngquery · numberREQUIRED
- Longitude in decimal degreese.g. -77.0365
- fieldsquery · string
- Comma-separated appends: census, cd, stateleg, school, timezone, or all
- limitquery · integer
- How many candidates to return, nearest firste.g. 1
REQUEST
curl "https://api.geocode.net/v1/reverse?lat=38.8977&lng=-77.0365" \ -H "X-API-Key: YOUR_KEY"
import requests
r = requests.get("https://api.geocode.net/v1/reverse?lat=38.8977&lng=-77.0365", headers={"X-API-Key": "YOUR_KEY"})
print(r.status_code, r.headers.get("X-Gw-Remaining"))
print(r.json())
const r = await fetch("https://api.geocode.net/v1/reverse?lat=38.8977&lng=-77.0365", {
headers: { "X-API-Key": "YOUR_KEY" }
});
console.log(r.status, r.headers.get("X-Gw-Remaining"));
console.log(await r.json());
RESPONSE
200Successful Response
{
"query": {
"lat": 38.8977,
"lng": -77.0365
},
"results": [
{
"formatted": "1600 Pennsylvania Ave NW, Washington, DC 20500",
"components": {
"number": "1600",
"street": "Pennsylvania",
"suffix": "Ave",
"postdirectional": "NW",
"city": "Washington",
"county": "District of Columbia",
"state": "DC",
"zip": "20500",
"country": "US"
},
"location": {
"lat": 38.897675,
"lng": -77.036545
},
"accuracy": 0.98,
"accuracy_type": "rooftop",
"source": "nad",
"fields": {
"distance_m": 4.8
}
}
]
}