On Tue, Jun 23, 2009 at 3:56 PM, Christoph Eckert <c...@christeck.de> wrote:

> Hi Brett,
>
> > That type of error is usually because you're running java 1.5 or older.
> > From your previous emails you seem to be running java 1.6 which should
> > be okay.  Can you double check to make sure you're still using 1.6?  If
> > you are then I'm not sure what's going on ...
>
> there's a global Java 1.5 installation, and a local 1.6 installation in
> ~/bin/
> I adjusted the osmosis shell script to use the latter one and yeah, it's up
> and running! Thanks a bunch for the help.
>
> Of course it immediately triggers the next question :) . I try to extract
> some
> data from an osm file which shall only contain the base net of roads,
> railways and cities. E.g. I do:
> ./osmosis-0.31/bin/osmosis
> --read-xml file="planet.bz2"
> --node-key-value keyValueList="place.city"
> --way-key-value
>
> keyValueList="highway.motorway,highway.motorway_link,highway.motorway_junction,highway.trunk,highway.trunk_link"
> --write-xml file="basemap.osm"
>
> This only writes nodes, no ways at all. Removing the nodes, it will write
> ways:
>
> ./osmosis-0.31/bin/osmosis
> --read-xml file="planet.bz2"
> --way-key-value
>
> keyValueList="highway.motorway,highway.motorway_link,highway.motorway_junction,highway.trunk,highway.trunk_link"
> --write-xml file="basemap.osm"
>
> So I thought I need to use the pipes as found in the documentation. So I
> tried:
>
> ./osmosis-0.31/bin/osmosis
> --read-xml file="planet.bz2"
> outPipe.0="readpipe"
> --node-key-value keyValueList="place.city"
> inPipe.0="readpipe" outPipe.0="outpipe"
> --way-key-value
>
> keyValueList="highway.motorway,highway.motorway_link,highway.motorway_junction"
> inPipe.0="readpipe" outPipe.0="outpipe"
> --write-xml file="basemap.osm"
> inPipe.0="outpipe"
>
> However, osmosis does not like my syntax. I'm obviously using the pipes in
> a
> wrong or at least unsupported :) manner. Any hint is much appreciated. Do I
> need the pipes in this case? If so, what should I change? Or an alternative
> syntax?
>
> Thanks & best regards,
>
> ce
>

What's happening there is that the node-key-value and way-key-value are
ANDed together (which would leave you with only ways which match your tags
and are composed of nodes tagged place=city), and you want an OR instead.
You were sort of on the right track with the pipes, but what you need to do
is use the "tee" function and apply the node-key-value filter to one leg of
the tee, and apply the way-key-value filter to the other leg of the tee,
then use the "merge" function to join the results. It would look something
like this:

./osmosis-0.31/bin/osmosis --read-xml file="planet.bz2" --tee outputCount=2
outPipe.0="nodes" outPipe.1="ways" --node-key-value
keyValueList="place.city" inPipe.0="nodes" --way-key-value
keyValueList="highway.motorway,highway.motorway_link,highway.motorway_junction,highway.trunk,highway.trunk_link"
inPipe.0="ways" --merge --write-xml file="basemap.osm"

I'm not sure if that will work exactly as written. You may need to add
outPipe arguments to the node-key-value and way-key-value filters and then
reference them as inPipe.0 and inPipe.1 arguments to the merge task.

Karl
_______________________________________________
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev

Reply via email to