I'm using osmfilter for the first time to filter to a .osm file containing only railway=station nodes.

It increases the output file tenfold.

I downloaded great-britain-latest.osm.pbf (~1.2Gb) from Geofabrik Converted it to .o5m using:

osmconvert64-0.8.8p great-britain-latest.osm.pbf -o=great-britain-latest.osm.o5m


osmfilter great-britain-latest.osm.o5m --keep-nodes="railway=station" -o=osmfilter_railway_station.osm

(~23 Gb!) Taking ~5mins to complete. It's too large to open.

I'm expecting a file of about 1.8Mb as from Overpass.

I've read the help documentation, can't see anything obvious. What am i doing wrong?

asked 09 Nov '20, 00:53

DaveF's gravatar image

accept rate: 6%

edited 09 Nov '20, 01:02


May be the issue is here: https://wiki.openstreetmap.org/wiki/Osmfilter#Keep_specific_Object_Type (looks like you need additional filters, either a --keep= before or --keep-ways= and --keep-relations= after).

(09 Nov '20, 20:52) SK53 ♦

Looks like osmfilter put all the data into the output file, not only the railway nodes. A 10x factor compared to the .pbf file is about what's expected in that case.

I am using osmium for these kinds of things (I am the author, so that's no wonder...). You don't need the intermediate o5m file and the whole thing is faster:

osmium tags-filter great-britain-latest.osm.pbf n/railway=station -o railway_stations.osm
permanent link

answered 09 Nov '20, 08:11

Jochen%20Topf's gravatar image

Jochen Topf
accept rate: 31%


Thanks, but unfortunately it doesn't run on Windows, unless I've missed some documentation(?).

I've also tried Osmosis, (osmosis --rbf great-britain-latest.osm.pbf --nkv keyValueList="railway.station" --wx railway_station.osm ) which worked, but took 4 times as long (65 secs) to complete as using Overpass. It surprises me that a remote server was much quicker than a local drive. Given the info I provided above, is this the expected time for such a routine?

(09 Nov '20, 12:25) DaveF

Osmium runs on Windows. But there are no prepacked binaries. So you have to compile it yourself.

The 65 secs for Osmosis sounds abound right. Osmosis has to read all the data and throw most of it away, that takes a lot of time. Overpass doesn't have to do this, because it has a specialized database behind it with indexes. (Osmium still has to do the same work as Osmosis, but will be noticably faster.)

(09 Nov '20, 13:30) Jochen Topf

Are there any instructions on how/what to compile or know if anyone has completed the task?

(09 Nov '20, 15:56) DaveF
Your answer
toggle preview

Follow this question

By Email:

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



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:


question asked: 09 Nov '20, 00:53

question was seen: 742 times

last updated: 09 Nov '20, 20:52

powered by OSQA