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:
See |
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 |
main_cat |
character. The first category the feature was assigned to, depending on the order of categories in the |
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
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)