osm_classify {osmclass}R Documentation

Classify OSM Features

Description

Classifies OSM features into meaningful functional or analytical categories, according to a supplied classification.

Usage

osm_classify(data, classification)

Arguments

data

imported layer from an OSM PBF file. Usually an 'sf' data frame, but the geometry column is unnecessary. Importantly, the data frame should have an 'other_tags' column with OSM PBF formatting.

classification

a 2-level nested list providing a classification. The layers of the list are:

categories a list of tags and matched values that constitute a feature category.
tags a character vector of tag values to match, or "" to match all possible values. It is also possible to match all except certain tags by negating them with "!" e.g. "!no". Obviously, it is not sensible to mix negation with other specifications.

See osm_point_polygon_class and osm_line_class for example classifications.

Value

a data.table with rows matching the input frame and columns

classified

logical. Whether the feature was classified i.e. matched by any tag-value in the classification.

main_cat

character. The first category the feature was assigned to, depending on the order of categories in the classification.

main_tag

character. The tag matched for the main category.

main_tag_value

character. The value matched on.

alt_cats

character. Alternative (secondary) categories assigned, comma-separated if multiple.

alt_tags_values

character. The tags and double-quoted values matched for secondary categories, comma-separated if multiple.

Note

It is not necessary to expand the 'other_tags' column, e.g. using osm_tags_df(). osm_classify() efficiently searches the content of that column without expanding it.

See Also

osmclass-package

Examples

# See Examples at ?osmclass for a full examples

# Classify OSM Points in Djibouti
djibouti_points_class <- osm_classify(djibouti_points, osm_point_polygon_class)
head(djibouti_points_class)
collapse::descr(djibouti_points_class)

[Package osmclass version 0.1.3 Index]