O'Reilly logo

OpenStreetMap by Jonathan Bennett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using tag filters to produce tailored datasets

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 acceptnodes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required