osm_tags_df {osmclass} | R Documentation |
Extract Tags as Columns from an OSM PBF Layer
osm_tags_df(data, tags, na.prop = 0)
data |
an imported layer from an OSM PBF file. Usually has a few important tags already expanded as columns, and an 'other_tags' column which compounds less frequent tags as character strings. |
tags |
character. A vector of tags to extract as columns. |
na.prop |
double. Proportion of features having a tag in order to keep the column. |
a data.table with the supplied tags
as columns, and the same number of rows as the input frame.
# See Examples at ?osmclass for full examples
# Extracting tags of interest (some of which are inside 'other_tags')
tags <- c("osm_id", "highway", "man_made", "name", "alt_name",
"description", "wikidata", "amenity", "tourism")
head(osm_tags_df(djibouti_points, tags))
# Only keeping tags with at least 5\% non-missing
head(osm_tags_df(djibouti_points, tags, na.prop = 0.05))