NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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 '20, 16:57

ralien's gravatar image

ralien
16224
accept rate: 0%

edited 25 Jan '20, 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, 20:13

Jochen%20Topf's gravatar image

Jochen Topf
5.2k55074
accept rate: 31%

edited 25 Jan '20, 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, 20:52) ralien

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:

×252
×147
×62

question asked: 25 Jan '20, 16:57

question was seen: 2,788 times

last updated: 25 Jan '20, 20:53

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum