This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Osmosis : –read-pbf, –tee then –merge

0

Hello ! I want to read a big pbf file (europe.osm.pbf) only one time and filter tags twice on it, so i'm using --tee 2

time osmosis \
    --read-pbf europe.pbf \
    --log-progress \
    --tee 2 \
    \
          --tag-filter accept-relations route=bus \
          --used-way \
          --tf reject-relations \
          --used-node \
          --tag-filter reject-ways building=yes \
                                   public_transport=platform \
                                   highway=construction \
    outPipe.0="bus_route" \
    \
          --tag-filter reject-relations \
          --tag-filter accept-ways highway=motorway,motorway_link \
          --tag-filter reject-ways disused=yes \
                                   highway=construction \
          --used-node \
    outPipe.0="freeways" \
  --merge inPipe.0="bus_route" inPipe.1="freeways"  --write-pbf bus_route_and_freeways.pbf

but this does not work : no error, but osmosis is running forever.

asked 12 Jan '18, 21:42

djakk's gravatar image

djakk
16112
accept rate: 0%


One Answer:

2

This problem is explained in https://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage_0.46: "If both inputs for the merge are coming from the same thread (e.g. using the tee task followed by the merge task), Osmosis will experience deadlock and the operation will never finish. One solution to this deadlock problem is to read the data in two separate tasks."

It might be easier to simply read the file twice. If you can use the osmium-tool command line program, that will be even quicker.

answered 12 Jan '18, 22:31

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Thanks a lot Frederik ! I've just installed osmium this morning, it is very fast indeed :O

(13 Jan '18, 09:58) djakk

Source code available on GitHub .