Reverse geocoding

GET /v1/reverse answers the opposite question. You give a coordinate, Findort tells you which address or place is there.

Request

HTTP
GET https://api.findort.ch/v1/reverse?lat=46.9465&lon=7.4443&limit=1
Authorization: Bearer pk_…

Typical uses: a "use my location" button in a form, a click on a map, or GPS points from an app that need a readable address.

Parameters

ParameterTypeDefaultDescription
latnumber, requiredLatitude, -90 to 90
lonnumber, requiredLongitude, -180 to 180
radiusnumberSearch radius in kilometres, 0.01 to 50. Limits the search to this distance.
limitnumber5Number of results, 1 to 20
langtextlocal languagede, fr, it or en
typeslistall typesas in search, for example types=address
keytextAPI key, if you cannot send an Authorization header

There is no country, near or bbox here: the coordinate already fixes the place.

Example

Shell
curl "https://api.findort.ch/v1/reverse?lat=46.9465&lon=7.4443&limit=1&types=address" \
  -H "Authorization: Bearer sk_…"
JSON
{
  "results": [
    {
      "id": "N3797624451",
      "label": "Bundesplatz 3, 3011 Bern",
      "name": "Bundesplatz 3",
      "type": "address",
      "category": "place:house",
      "address": {
        "street": "Bundesplatz",
        "housenumber": "3",
        "postcode": "3011",
        "city": "Bern",
        "state": "Bern",
        "country": "Switzerland",
        "countryCode": "CH"
      },
      "location": { "lat": 46.94652, "lon": 7.44436 }
    }
  ],
  "attribution": "© OpenStreetMap contributors, ODbL"
}

The response has the same format as search, see response format. The nearest result comes first. If nothing is within the radius, results is empty.

With the browser's location

JavaScript
import { Findort } from 'findort';

const findort = new Findort('pk_…', { lang: 'en' });

navigator.geolocation.getCurrentPosition(async ({ coords }) => {
  const [place] = await findort.reverse(coords.latitude, coords.longitude, { limit: 1, types: 'address' });
  document.querySelector('#address').value = place?.label ?? '';
});