I'm trying to filter sport, leisure and amenity keys and then merge them with Osmosis:

osmosis --read-pbf file=switzerland.pbf --tf accept-nodes sport=* --tf accept-ways sport=* --tf reject-relations outPipe.0="sport" --read-pbf file=switzerland.pbf --tf accept-nodes amenity=* --tf accept-ways amenity=* --tf reject-relations outPipe.0="amenity" --read-pbf file=switzerland.pbf --tf accept-nodes leisure=* --tf accept-ways leisure=* --tf reject-relations outPipe.0="leisure" --merge inPipe.0="sport" inPipe.1="amenity" inPipe.2="leisure" --write-pgsql host=128.178.1.1 database=myDB user=myUsn password=myPwd

I have this error message that I don't understand:

The following named pipes (leisure) and 0 default pipes have not been terminated with appropriate output sinks.

I'm new with Osmosis. Sorry if this is a stupid question. But I cannot find the error.

Thank you in advance.

asked 14 Apr '14, 10:35

antonind's gravatar image

antonind
36338
accept rate: 0%

edited 14 Apr '14, 10:38


--merge can only merge two pipes, not more; you must use two instances of --merge to merge three pipes. Try this:

osmosis \
  --read-pbf switzerland.osm.pbf --tf accept-nodes sport=* --tf accept-ways sport=* --tf reject-relations \
 --read-pbf file=switzerland.osm.pbf --tf accept-nodes amenity=* --tf accept-ways amenity=* --tf reject-relations \
 --read-pbf file=switzerland.osm.pbf --tf accept-nodes leisure=* --tf accept-ways leisure=* --tf reject-relations  \
 --merge --merge --write-pgsql host=128.178.1.1 database=myDB user=myUsn password=myPwd

You might want to give osmfilter a try, it is less complicated for use cases like this.

permanent link

answered 14 Apr '14, 11:17

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
70.9k836431106
accept rate: 24%

edited 14 Apr '14, 11:29

SomeoneElse's gravatar image

SomeoneElse ♦
32.2k63333752

Your error message is explained in another answer (the merge task can merge only two pipes, so you need two merge tasks). But there's another way to address your problem, which is to avoid merging entirely: You're filtering one tag pattern in each of three parallel pipelines, then merging those pipelines. In fact, each tag-filter task can accept more than one tag pattern, and will accept/reject entities if they match any of those supplied tag patterns. Here is an alternative command creating a single pipeline that should produce exactly the same results as your three-pipeline approach:

osmosis \
 --read-pbf switzerland.osm.pbf \
 --tf accept-nodes sport=* amenity=* leisure=* \
 --tf accept-ways sport=* amenity=* leisure=* \
 --tf reject-relations \
 --write-pgsql host=128.178.1.1 database=myDB user=myUsn password=myPwd

However, both your command and the one I proposed will probably not produce the output you are expecting. Both commands are retaining all nodes and ways that have a sport, amenity, or leisure tag, but they are not retaining any nodes referenced by these ways if the referenced nodes don't also have a sport, amenity, or leisure tag. This is the purpose of the used-node task: it will retain any nodes that are referenced by a retained way.

We can't just insert a used-node task into this single pipeline, because we want to retain both the nodes with certain tags and the nodes used by ways with those tags. So here you need two pipelines, but only one merge task:

osmosis \
 --read-pbf switzerland.osm.pbf \
 --tf accept-nodes sport=* amenity=* leisure=* \
 --tf reject-ways \
 --tf reject-relations \
 --read-pbf switzerland.osm.pbf \
 --tf accept-ways sport=* amenity=* leisure=* \
 --tf reject-relations \
 --used-node \
 --merge \
 --write-pgsql host=128.178.1.1 database=myDB user=myUsn password=myPwd
permanent link

answered 06 Feb '16, 18:43

abyrd's gravatar image

abyrd
111
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×219

question asked: 14 Apr '14, 10:35

question was seen: 2,585 times

last updated: 06 Feb '16, 18:43

powered by OSQA