You can extract particular types of features from OpenStreetMap data to give you a dataset that only includes the features you're interested in, and not others. You can filter the data based purely on a combination of primitive type and tags, and you can combine multiple filters to produce a set of data to fit your exact requirements.
The tag filter task works on a single primitive type per task, and can include or exclude those primitives from the pipeline based on the tags used. It leaves other types of primitive untouched.
To extract all nodes from our United Kingdom extract tagged with shop=*
, we'd use the following command:
osmosis --read-xml file="united_kingdom.osm.bz2" --tag-filter accept-nodes shop=* --tag-filter reject-ways --tag-filter reject-relations --write-xml file="uk-shops.osm"
Already, you can see multiple tasks in use in Osmosis. We're using three separate tag filter tasks:
The first filters the nodes in the pipeline to include...