7

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?

1 Answer 1

5

(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
6
  • Nope, none of the approaches works. Commented Sep 27, 2014 at 10:01
  • If it doesn't work, what happens instead?
    – BradHards
    Commented Sep 27, 2014 at 10:52
  • The resulting file is identical, in both cases the abandoned station of Laken is in the list. Commented Sep 27, 2014 at 11:12
  • Thanks, disused stations have indeed disappeared from my list. However, I still have an abandoned one in my list ` <node id="96670229" version="18" timestamp="2014-08-08T15:43:37Z" uid="9176" user="Maarten Deen" changeset="24618456" lat="50.8813275" lon="4.3065858"> <tag k="abandoned" v="yes"/> <tag k="abandoned:railway" v="halt"/> <tag k="alt_name" v="Ganshoren-Expo"/> <tag k="note" v="Will be opened again when the RER-project is finished."/> <tag k="railway" v="halt"/> </node>` Commented Sep 27, 2014 at 18:05
  • And other stations tagged station=disused which I don't seem to be able to filter either. Maybe too many arguments? Are there any restrictions? Commented Sep 27, 2014 at 18:10

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.