OpenStreetMap Features and Tags in R
The R Project is free software for statistical computing

The OpenStreetMap data package (osmdata) enables you to retrieve sf objects to plot maps. To add a map feature (e.g. a street, a river, a building), you select the feature key and its associated tag.

If value is blank, all available tags associated to the given feature key will be retrieved. This could be unproductive as you do not always need everything that is available.

Sometimes the tag is quite explicit. For instance, key = 'water' with value = 'river' retrieves information on rivers.

# load package
library(osmdata)

# retrieve sf object for features on a map
sf_object_water <- getbb("Berlin, Germany")%>%
  opq()%>%
  add_osm_feature(key = 'water', value = c('river')) %>%
  osmdata_sf()

Yet, this value alone will not take into consideration canals, streams and ponds. Thus it is helpful to see available features and tags.

# find (most of) features available
available_features()

# find all tags associtated to feature 'water'
available_tags('water')

To find out the feature and tag names associated to an element of a map:

  1. Find the location of interest in www.openstreetmaps.org.

    2021-02-20-osm-feature-r-img01

  2. Right click on the map, and click on Query Features.

    2021-02-20-osm-feature-r-img02

  3. Hoover over the features on the right-hand side until the element you are looking for is highlighted in orange.

    2021-02-20-osm-feature-r-img03

  4. Click on the feature and see the associated tags.

    2021-02-20-osm-feature-r-img04

Keep in mind that elements on a map may have more than one feature and tag name. For instance, the features water and waterway as very similar and are both available.

OpenStreetMap Features and Tags in R
Older post

Challenge November 2020: My First 100k Run

Running alongside the Mauerweg on a cold November day

Newer post

Saving and Loading Scalers using MLflow and Databricks with Python

Chances are, you will be needing scalers to make predictions on new data sets

OpenStreetMap Features and Tags in R