I'm trying to extract everything related to railways from pbf file using osmosis. I've tried several ways but couldn't find a solution. I got everthing about railways extracted except rails. Here is what I've tried latest:

osmosis --read-pbf file=turkey-latest.osm.pbf --tf accept-nodes railway=* --tf reject-relations --tf reject-ways --write-xml yollar.osm

If I remove --tf reject-ways I will have enourmously large data.

I'm using Osmosis v0.47 and latest pbf data.

  • 1
    Have you tried railway=rail?
    – Erik
    May 27, 2019 at 8:58
  • Yes. It returns zero results, 1 kb empty osm file.
    – user143701
    May 27, 2019 at 9:00
  • 1
    Is there a specific reason, you only want to get railway-nodes, but nothing else? Especially, when rails are linear features...
    – Erik
    May 27, 2019 at 9:08
  • Yes, I only need those for my project.
    – user143701
    May 27, 2019 at 9:13
  • 2
    I just checked with the Geofabrik-data for Germany: There are only line-features for railways, no nodes/points. So, your request most likely doesn't return anything, because there is nothing to return.
    – Erik
    May 27, 2019 at 9:33

1 Answer 1


After some research and with help of @Erik I've found out I'm trying to extract nodes but rails are stated by line. So I found the solution by seperating my osmosis queries.

For extracting anything related railways:

osmosis --read-pbf file=turkey-latest.osm.pbf --tf accept-nodes railway=* --tf reject-relations --tf reject-ways --write-xml nodes.osm 

For extracting rails:

osmosis --read-pbf file=turkey-latest.osm.pbf --tf accept-ways railway=rail --tf reject-relations --used-node --write-xml rails.osm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.