Reverse geocoding
Turn a latitude/longitude into the address or place at that point.
Signed in? Open this endpoint in the dashboard playground, which uses your organization automatically. Signed out, use Try in Playground below with your API key.
apiKey<token>Your API key from the dashboard, sent as ?apiKey=<key>.
lat*numberLatitude (-90 to 90).
-90 <= value <= 90lon*numberLongitude (-180 to 180).
-180 <= value <= 180limit?integerMaximum number of results, 1-100 (default 1). Deviation (approximated): the result list is short regardless; see the operation description.
1 <= value <= 1001type?stringRequested result type. Omitted: building-level lookup (Canonical Addresses within 75 m, then Nominatim).
street queries Nominatim at street zoom; country, state, city, postcode return the address
found at the point reduced to that level (empty result if the level is missing); amenity queries
Nominatim POI and address layers and returns a result only if it is an amenity. Canonical Addresses are
not used when type is set.
Deviation (unsupported): locality and building are rejected with 400.
"country""state""city""postcode""street""amenity"countrycodes?array<>Keep only results in these ISO 3166-1 alpha-2 countries (case-insensitive, at most 10). Repeat the
parameter or comma-separate values. Applied after lookup, so it can empty the result list.
Deviation (approximated): any two-letter code is accepted; only us and ca have data.
items <= 10lang?stringResult language, forwarded to Nominatim as accept-language. Omitted: local names.
Deviation (approximated): no default of en; Canonical Address results are not translated.
"ab""aa""af""ak""sq""am""ar""an""hy""as""av""ae""ay""az""bm""ba""eu""be""bn""bh""bi""bs""br""bg""my""ca""ch""ce""ny""zh""cv""kw""co""cr""hr""cs""da""dv""nl""en""eo""et""ee""fo""fj""fi""fr""ff""gl""ka""de""el""gn""gu""ht""ha""he""hz""hi""ho""hu""ia""id""ie""ga""ig""ik""io""is""it""iu""ja""jv""kl""kn""kr""ks""kk""km""ki""rw""ky""kv""kg""ko""ku""kj""la""lb""lg""li""ln""lo""lt""lu""lv""gv""mk""mg""ms""ml""mt""mi""mr""mh""mn""na""nv""nb""nd""ne""ng""nn""no""ii""nr""oc""oj""cu""om""or""os""pa""pi""fa""pl""ps""pt""qu""rm""rn""ro""ru""sa""sc""sd""se""sm""sg""sr""gd""sn""si""sk""sl""so""st""es""su""sw""ss""sv""ta""te""tg""th""ti""bo""tk""tl""tn""to""tr""ts""tt""tw""ty""ug""uk""ur""uz""ve""vi""vo""wa""cy""wo""fy""xh""yi""yo""za"format?stringResponse format.
"geojson""json""geojson""xml"Results sorted by distance; empty when nothing is found. Header X-Geo-Stage names the first result's stage.
- response
GeoJSON FeatureCollection (format=geojson, application/geo+json). features is empty when nothing is found.
type*unknownfeatures*array<>query*Echo of the request coordinates.
curl -X GET 'https://api.data.graphitelab.ai/v1/geocode/reverse?lat=38.8977&lon=-77.0365&limit=2&type=street&countrycodes=us&lang=en&format=json'{ "results": [ { "name": "White House", "country": "United States", "country_code": "us", "state": "District of Columbia", "state_code": "DC", "city": "Washington", "postcode": "20500", "street": "Pennsylvania Avenue Northwest", "housenumber": "1600", "lon": -77.0365525, "lat": 38.8976387, "formatted": "White House, 1600 Pennsylvania Avenue Northwest, Washington, DC 20500, United States", "address_line1": "1600 Pennsylvania Avenue Northwest", "address_line2": "Washington, DC 20500, United States", "result_type": "amenity", "datasource": { "sourcename": "openstreetmap", "attribution": "© OpenStreetMap contributors", "license": "Open Database License", "url": "https://www.openstreetmap.org/copyright" }, "rank": { "confidence": 1, "confidence_city_level": 1, "confidence_street_level": 1, "confidence_building_level": 1, "match_type": "match_by_city_or_disrict", "importance": 0.00000999999999995449 }, "place_id": "gp:osm:r19761182", "distance": 8.2, "bbox": { "lon1": -77.0368541, "lat1": 38.8974904, "lon2": -77.0362509, "lat2": 38.8977959 } } ], "query": { "lat": 38.8977, "lon": -77.0365 }}Full schema: API reference
GET /v1/geocode/reverse returns the address or place nearest a coordinate. Use it to label a map click, a GPS fix or a stored point. Without type you get a building-level answer; with type you can ask for the street, city, state, postcode, country or an amenity instead.
How it works
Everything is answered from the service's own Engines, never from a third party.
- Canonical Addresses (PostGIS). Without
type, the gateway looks up the nearest Canonical Address in the Address Point layer (NAD for the US, StatCan NAR for Canada, Overture). Any within 75 m count asbuildingresults. The query reads at most 30 candidates. - Nominatim (OSM, TIGER). If fewer than
limitresults exist, the gateway asks Nominatim for a reverse lookup at building zoom (street zoom fortype=street). A building already returned by step 1 is not repeated. - Sort and filter. Results are sorted by distance, then
countrycodesis applied, then the list is cut tolimit.
With type set, only Nominatim answers. The X-Geo-Stage response header names the stage of the first result (canonical, an Engine stage, or none).
Quick start
curl -s "https://api.data.graphitelab.ai/v1/geocode/reverse?lat=38.8977&lon=-77.0365&apiKey=$GRAPHITE_API_KEY"{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "White House",
"country_code": "us",
"state_code": "DC",
"city": "Washington",
"postcode": "20500",
"street": "Pennsylvania Avenue Northwest",
"housenumber": "1600",
"formatted": "White House, 1600 Pennsylvania Avenue Northwest, Washington, DC 20500, United States",
"result_type": "amenity",
"datasource": {
"sourcename": "openstreetmap",
"attribution": "© OpenStreetMap contributors",
"license": "Open Database License",
"url": "https://www.openstreetmap.org/copyright"
},
"rank": { "confidence": 1, "match_type": "match_by_city_or_disrict" },
"place_id": "gp:osm:r19761182",
"distance": 8.2
},
"geometry": { "type": "Point", "coordinates": [-77.0365525, 38.8976387] }
}
],
"query": { "lat": 38.8977, "lon": -77.0365 }
}Parameters
| Name | Type | Required | What it does |
|---|---|---|---|
lat | number | yes | Latitude, -90 to 90. |
lon | number | yes | Longitude, -180 to 180. |
limit | integer | no | Maximum results, 1 to 100 (default 1). |
type | string | no | One of country, state, city, postcode, street, amenity. Omitted means building-level lookup. street queries Nominatim at street zoom. country, state, city and postcode return the address found at the point reduced to that level (empty if the level is missing). amenity returns a result only if the point resolves to an amenity. Canonical Addresses are not used when type is set. |
countrycodes | array of strings | no | Keep only results in these ISO 3166-1 alpha-2 countries (case-insensitive, at most 10). Repeat the parameter or comma-separate values. Applied after lookup, so it can empty the list. |
lang | string | no | ISO 639-1 result language, forwarded to Nominatim as accept-language. Omitted means local names. |
format | string | no | json, geojson (default) or xml. |
Response
The default geojson format is a FeatureCollection sorted by distance; format=json returns the same properties under results. An uncovered point returns an empty list, not an error.
| Field | Meaning |
|---|---|
place_id | Typed ID, gp:<kind>:<key>. Here gp:osm:... for OSM objects and gp:addr:canonical:... for Canonical Addresses. |
result_type | building for Canonical Addresses, otherwise what Nominatim found (amenity, street, city, ...) or the requested type. |
distance | Meters from the query point to the result. |
datasource | Where the result came from. OSM results carry "© OpenStreetMap contributors". Address Point results list their sources and each licence's attribution. |
datasource.sources[] | Extra: present when several Address Point sources agree on the same address. |
rank | Geoapify-shaped confidence fields filled by the service's own scoring. |
bbox | Bounding box of the result, in properties and at feature level. |
Differences from Geoapify
-
approximated: at most one Nominatim result plus the Canonical Addresses within 75 m are returned, so lists are short (usually 1 to 2) even with a large
limit. -
approximated (
limit): accepted up to 100, but few candidates exist per point. -
approximated (
countrycodes): a post-filter on results. Any two-letter code is accepted, but onlyusandcahave data. -
approximated (
lang): not defaulted toen. Canonical Address results ignorelang. -
unsupported:
type=localityandtype=buildingare rejected with 400. To get a building, omittype. -
empty: only a subset of Geoapify's place fields is populated.
-
extra:
datasource.sources[]when several Address Point sources agree, and theX-Geo-Stageresponse header.
US and Canada notes
-
Coverage is the United States and Canada only. A point elsewhere returns an empty list.
-
Building-level answers come from NAD (US), StatCan NAR (Canada) and Overture; OSM and TIGER fill the rest through Nominatim.
-
Canadian postcodes come back in full postal-code form, for example
K1P 5M7. -
Address Point street casing is echoed from the source, so you can see values like
PENNSYLVANIA Avenue Northwest.
More examples
Canadian point, answered with an OSM amenity result.
curl -s "https://api.data.graphitelab.ai/v1/geocode/reverse?lat=45.4215&lon=-75.6972&apiKey=$GRAPHITE_API_KEY"Errors and limits
| Status | Meaning |
|---|---|
| 400 | Invalid or missing parameters, including type=locality or type=building. |
| 401 | Missing or invalid API key. |
| 500 | Unexpected gateway error, including a Nominatim call that exceeds its 8 s timeout. |
| 503 | Nominatim answered with an error status. |
Limits: limit is 1 to 100, countrycodes takes at most 10 codes, and Canonical Addresses count only within 75 m of the point.
Known issue: with type=city, state, postcode or country, the result keeps the building node's place_id, bbox and distance, and rank.match_type is match_by_city_or_disrict. Treat those fields as describing the nearest building, not the area. The gp:addr:canonical path was documented from the code and has not been hit live.
Try in Playground (signed in to your Graphite Lab organization). Signed out, use the paste-your-key widget on the reference page.