Back to data catalog

Geocoding API

Geocoding and reverse-geocoding based on OpenStreetMap®-data

More info

Data sources

The API is exclusively fetching data from https://photon.komoot.io. The service is based on OpenStreetMap® data, which is licensed under the Open Data Commons Open Database License (ODbL), by the OpenStreetMap Foundation (OSMF).

Processing

The data obtained from https://photon.komoot.io is presented as is, without any further processing or modification.

Examples

Example 1

Retrieving the coordinates of Berlin.

const response = await fetch(
	"https://api.openepi.io/geocoding/?" + new URLSearchParams({ q: "Berlin" })
)
const data = await response.json()

// prints the coordinates of the first result
console.log(data.features[0].geometry.coordinates)

Example 2

Retrieving a location near the given coordinate.

const response = await fetch(
	"https://api.openepi.io/geocoding/reverse?" +
		new URLSearchParams({
			lon: "13.438596",
			lat: "52.519854",
		})
)
const data = await response.json()

// prints the name of the first result
console.log(data.features[0].properties.name)