New API for OSM


New API has been developed that provides easy access to Open Street Map geodatabase.
The API does not only provide you with the features but also gives you the ability to filter these features using buffer filtration technique.
Provide the API with the center point and radius, and all the requested POI’s within that buffer will be provided in JSON format.
I have created a demo on how to download restaurants, cafes and pubs that are within a 3000 meter radius from Stockholm central station.
Currently the API provides information within Sweden and Germany for the following categories (keys): Amenity, highway, historic, leisure, office, public transport, shop, sport and tourism. Node subcategories (values) for all the mentioned categories are available.
The development of API will be continued, and it will include buildings, lands, railways, roads, transport, waterway, population, regions, municipality borders, and much more.
The buffer radius is limited to max 3000 meter, if you need higher radius like 50 000 meter, then I need to give you a special API key. smile


Hello! Sounds great. Could you please share a link to the API documentation?


Its new API, the document is not completed yet.

You can use the following information for now, and I will come back to you on the final document.


API variables are:
• **dataBaseName: **CeTLeR contains several different geodata databases, in our assignment we will be working with the database named CeTLeR.
bufferType: several filtration buffer types are available; we will use radius type only.
data: type of data you want to retrieve. We will use “poi” data type.
key & value: We will use keys (amenity, highway) and all its values. Please visit for more information.
Variable value can accept multi selection separated by “;”. Example: (restaurant;cafe)
centerpoint: latitude and longitude that represents the buffer center point.
radius: in meter; represents the buffer radius.
apiKey: authentication code. Each student will be given one unique code to be used for this assignment.

The idea of the API is to provide all the requested features for the selected category within the given buffer.

Example of a call to OSM API in R:

url <-""

apiData = GET(url, 
           query = list(dataBaseName='OSM', ApiKey="omar-public", bufferType="radius", data="poi",
                        centerPoint ="52.497424, 13.372886", radius=3000,  

To plot the downloaded feature on a map use the following R code:

apiData = rawToChar(apiData$content)
jsonData = fromJSON(apiData)
sfData <- st_as_sf(jsonData, coords = c("longitude", "latitude"), crs = 4326)
tm_basemap(leaflet::providers$OpenStreetMap) +
  tm_shape(sfData) +   tm_dots(col = "value", palette=c(restaurant='green', cafe='red', pub='black'),
                           stretch.palette = FALSE, size=.1, shape =21)

Retrieve data structure:

The response will be in JSON format. The format is shown below:

    "poiName": "Tullinge Gymnasium",
    "key": "amenity",
    "value": "school",
    "latitude": 59.2141762,
    "longitude": 17.9181938
    "poiName": "Hörningsnässkolan",
    "key": "amenity",
    "value": "school",
    "latitude": 59.2360153,
    "longitude": 17.9942684

The retrieved data will contain the following fields:
• Point of interested name.
• Key.
• Value.
• Latitude.
• Longitude.


An example HTTP request (head + body) would be helpful to translate your R example to other programming languages

So this is not meant to be a full replacement of the v0.7 API, allowing for both downloading data and submitting changesets, but rather an alternative query API, somewhere in between the old XAPI and the much more powerful, but also way more complex OverPass API, filling a gap between these two ends of the spectrum?

Hi Wulf4096,

The following code used .Net console application to retrieve data from OSM.

static void Main(string[] args)
            string jsonString = "";
           string URL = ",13.372886&radius=3000&key=amenity&value=restaurant;cafe;pub&data=poi";
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
            request.ContentType = "application/json; charset=utf-8";
            HttpWebResponse response = request.GetResponse() as HttpWebResponse;
            using (Stream responseStream = response.GetResponseStream())
                StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
                jsonString = reader.ReadToEnd();

No its not replacement, but its faster. And this is just the beginning, we are still developing the API.

Nice! Same in code in python:


import requests
from dataclasses import dataclass

class POI:
    poiName: str
    key: str
    value: str
    latitude: float
    longitude: float

resp = requests.get("", params={
    "dataBaseName": "OSM",
    "ApiKey": "omar-public",
    "bufferType": "radius",
    "centerPoint": "53.57003,9.95758",
    "radius": "3000",
    "key": "amenity",
    "value": "restaurant;cafe;pub",
    "data": "poi",

for poi in resp:

Would it be possible to add the OSM object id, e.g. “n6924790948” for a node?

Will add it now. give me 15 minutes. :slight_smile:

I have added new field called osm_id, which contains the object ID.

@alnyme what is your database and how do you get the data from the central osm database?