Geocoding
Reverse geocode a coordinate to an address, and fetch a geocoder (Pelias) place by its gid.
Fetch a geocoder (Pelias) place by gid
Resolves a single address/street record from the Pelias geocoder by its global id. These records have no geo_places row, so they cannot be fetched via /place/:osmType/:osmId.
Query Parameters
idRequiredstringPelias global id (gid), e.g. "openaddresses:address:us/ny/city_of_new_york:7e5b…".
Response Body
curl -X GET "https://example.com/geocode/place?id=string"fetch("https://example.com/geocode/place?id=string")package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/geocode/place?id=string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/geocode/place?id=string"
response = requests.request("GET", url)
print(response.text)Empty
Reverse geocode a coordinate
Finds the administrative hierarchy containing the given coordinate and returns a structured address object along with the raw boundary rows.
Address components are mapped from OSM admin levels:
admin_level >= 8→ cityadmin_level >= 6→ countyadmin_level >= 4→ stateadmin_level >= 2→ country
Query Parameters
latRequiredstringLatitude of the point to reverse geocode (WGS 84).
lngRequiredstringLongitude of the point to reverse geocode (WGS 84).
Response Body
curl -X GET "https://example.com/geocode?lat=string&lng=string"fetch("https://example.com/geocode?lat=string&lng=string")package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://example.com/geocode?lat=string&lng=string"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/geocode?lat=string&lng=string"
response = requests.request("GET", url)
print(response.text)Empty