Book Image

OpenStreetMap

Book Image

OpenStreetMap

Overview of this book

Imagine being able to create accurate maps that look how you want them to, and use them on the Web or in print, for free. OpenStreetMap allows exactly that, with no restrictions on how or where you use your maps. OpenStreetMap is perfect for businesses that want to include maps on their website or in publications without paying high fees. With this book in hand you have the power to make, alter, and use this geographical data in a collaborative way from anywhere on the Earth.OpenStreetMap was started because most maps you think of as free actually have legal or technical restrictions on their use, holding back people from using them in creative, productive, or unexpected ways. This book will allow you to take control of your own maps and use them smoothly. This book introduces the reader to the OpenStreetMap project and shows you how to participate in the project, and make use of the data it provides. No prior knowledge of the project is assumed, and technical details are kept to a minimum.In this book, you'll learn how easy it is to add your neighborhood to OpenStreetMap using inexpensive GPS equipment, or even no GPS at all. You'll find out how to communicate with other mappers working in the same area, and where to find more information about how to map the world around you.Once you have your area mapped, you'll learn how to turn this information into maps, whether for use in print or online, large or small, and with the details you want shown. The book describes several rendering methods, each suited to different types of map, and takes you through a tutorial on each one.
Table of Contents (17 chapters)
OpenStreetMap
Credits
About the Author
About the Reviewers
Preface
4
How OpenStreetMap Records Geographical Features
Index

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