[GIS] OSMOSIS: How to extract all railway stations in use

openstreetmaposmosis

I'm trying to retrieve a list of all railway stations of Belgium that are in use. I downloaded the country osm from http://download.geofabrik.de/europe/belgium-latest.osm.pbf. I tried the following command to extract all stations:

osmosis --read-pbf file=belgium-latest.osm.pbf --tf accept-nodes railway=station,halt --tf reject-nodes disused=*,abandoned=*,railway=disused,abandoned --tf reject-relations --tf reject-ways --write-xml be_railway_stations.osm

However, in my output I still have disused stations, e. g.

<node id="1313036421" version="6" timestamp="2012-07-06T13:22:20Z" uid="445028" user="Sebke" changeset="12130333" lat="50.8773652" lon="4.3551874">
    <tag k="abandoned" v="yes"/>
    <tag k="disused" v="yes"/>
    <tag k="name" v="Laken - Laeken"/>
    <tag k="name:fr" v="Laeken"/>
    <tag k="name:nl" v="Laken"/>
    <tag k="railway" v="station"/>
</node>

Where do I go wrong?

Best Answer

(Third try, see comments)

Separate the rejects for each key, because the comma is reserved as a value separator:

/path/to/osmosis.bat --read-pbf file=belgium-latest.osm.pbf --tf accept-nodes railway=station,halt --tf reject-nodes disused=* --tf reject-nodes abandoned=* --tf reject-nodes railway=disused,abandoned --tf reject-nodes station=disused --tf reject-relations --tf reject-ways --write-xml be_railway_stations.osm

or separate the key-value pairs by blanks:

/path/to/osmosis.bat --read-pbf file=belgium-latest.osm.pbf --tf accept-nodes railway=station,halt --tf reject-nodes disused=* abandoned=* railway=disused,abandoned station=disused --tf reject-relations --tf reject-ways --write-xml be_railway_stations.osm

Alternatively, on several lines of a batch file:

osmosis --read-pbf file=belgium-latest.osm.pbf\
    --tf accept-nodes railway=station,halt\
    --tf reject-nodes disused=*\
    --tf reject-nodes abandoned=*\
    --tf reject-nodes railway=disused,abandoned\
    --tf reject-nodes station=disused\
    --tf reject-relations\
    --tf reject-ways\
    --write-xml be_railway_stations.osm

osmosis --read-pbf file=belgium-latest.osm.pbf\
    --tf accept-nodes\
         railway=station,halt\
    --tf reject-nodes\
         disused=*\
         abandoned=*\
         railway=disused,abandoned\
         station=disused\
    --tf reject-relations\
    --tf reject-ways\
    --write-xml be_railway_stations.osm