Osmosis Railway extract

Hi,

I new to this and have recently downloaded the latest Planet.osm. I need to extract the world Railway layer using Osmosis. The problem is I can’t figure out the correct command. I just need the main railway lines/paths, no trams, subways, stations etc. Can anyone help?

Thanks.

what command have you tried so far?

Alternatively, have a look at http://wiki.openstreetmap.org/wiki/Osmfilter

or http://wiki.openstreetmap.org/wiki/Overpass_API

Hi,

Thanks for the reply. I have tried various commands, my latest is:

C:\Users\Barrys Laptop\Desktop>D:\Osmosis\bin\osmosis.bat --read-xml file=/H:/planet-130731.osm --tag-filter reject-relations --tag-filter accept-ways railway=rail --used-node --write-xml file=/D:/dump.osm

Most of the commands I’ve tried either yield an error with no data or enormous files that I can’t open with QGIS.

Thanks.

Hi All,

Any help on this problem? I’m still stuck.

Thanks.

Ok, I’m trying osmfilter with this command: osmfilter planet-130731.osm --keep=“railway=rail” --drop-nodes --drop-relations >rail.osm
So far the hard drive seems to be doing a lot of work but the output file is still at 0kb?

Barry.

Please try to use osmfilter with a smaller data extract … it seems that you are using the whole OSM planet dataset.

have a look e.g. at geofabrik.de … they offer country extracts by region … if necessary, do a conversion of pbf format to o5m or osm if needed via osmconvert.exe

and try osmfilter with -v parameter … should bring some screen output about being busy.

Success?

Hi,

Unfortunately I need the whole dataset, Downloading the regions is no good for what I’m doing. This is what I’m getting below, does it look correct to you?

H:\osmfilter>osmfilter -v planet-130731.osm --drop-nodes=“railway=rail” --drop-r
elations=“railway=rail” --keep=“railway=rail” >d:\rail.osm

osmfilter Parameter: planet-130731.osm
osmfilter Parameter: --drop-nodes=railway=rail
osmfilter: Filter: drop nodes:
osmfilter: Filter: “railway” = “rail”
osmfilter Parameter: --drop-relations=railway=rail
osmfilter: Filter: drop relations:
osmfilter: Filter: “railway” = “rail”
osmfilter Parameter: --keep=railway=rail
osmfilter: Filter: keep nodes:
osmfilter: Filter: “railway” = “rail”
osmfilter: Filter: keep ways:
osmfilter: Filter: “railway” = “rail”
osmfilter: Filter: keep relations:
osmfilter: Filter: “railway” = “rail”

Thanks.

I tried your command queue with a recent extract from Germany in o5m format (done with osmconvert.exe) … it is faster to work with than pure *.osm

and then I have a result file rail.osm that has file size 221 MB !!

So it seems that something with your planet fiole is wrong.

So I repeat: Try your workflow with a smaller extract to find the error.

Hi Stephan,

I appreciate all your help, I’ll have another go soon. Something has gone wrong with my .osm file, osmfilter is telling me access denied!

Thanks again.