I want to retrieve a map of all the roads that are a part of a particular relation. This can be a specific public transport route in a city, or its entire public transport network. I have the following input data:

  • the map of the country downloaded from Geofabrik as country-latest.osm.pbf
  • the relation ID

For example, for the country of Moldova, relation 6726484 includes all the public transport routes in its capital.

Is it possible to filter this data with osmosis, using the command line?

So far my best shot at it is osmosis --rbf moldova-latest.osm.pbf --tf accept-ways highway=* --tf reject-ways highway=steps,footway,pedestrian,service,residential --wx moldova-roads-only.osm

In other words, I am removing all the ways that are not likely to be part of any route, but this is a very rough approach, and I suspect that I could get much better results if I could leverage the information about the relation itself.

How can this be accomplished?

asked 25 Jan, 16:57

ralien's gravatar image

ralien
16124
accept rate: 0%

edited 25 Jan, 20:53


You can do this with Osmium using the getid command:

osmium getid -r moldova-latest.osm.pbf rRELATION_ID

Osmium also has the tags-filter command to filter by tags if you need that, too.

permanent link

answered 25 Jan, 20:13

Jochen%20Topf's gravatar image

Jochen Topf
4.6k54665
accept rate: 32%

edited 25 Jan, 20:14

Thanks, this does exactly what I wanted. I am marking it as the accepted answer, even though it is osmium rather than osmosis. I will edit the question title, to make it easier to find.

(25 Jan, 20:52) ralien
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×228
×126
×56

question asked: 25 Jan, 16:57

question was seen: 250 times

last updated: 25 Jan, 20:53

powered by OSQA