1

I am passing osmosis with along the base parameters this additional option: --tf accept-nodes way=*

With this I could filter only the <way...> nodes and the result is something like this:

  <way id="96036111" version="5" timestamp="2018-03-03T02:44:07Z" uid="0" user="">
    <nd ref="1112713500"/>
    <nd ref="1112712866"/>
    <nd ref="1112712764"/>
    <nd ref="1039249814"/>
    <tag k="name" v="Avenida del Prado"/>
    <tag k="highway" v="residential"/>
  </way>

I don't figure out how to remove the <nd> elements and keep only <tag ...>, so the result would be:

  <way id="96036111" version="5" timestamp="2018-03-03T02:44:07Z" uid="0" user="">
    <tag k="name" v="Avenida del Prado"/>
    <tag k="highway" v="residential"/>
  </way>

My question:
How can I remove the <nd..> elements from the result?

Peter VARGA
  • 121
  • 6

1 Answers1

0

I am using osmosis under Linux, so sed can be used to remove these elements. Even this solution works, I am curious if it can be done directly with osmosis.

bin/osmosis -q ... --tf accept-nodes way=* --wk keyList=name --wx file=- \
    | sed -e 's/[ ]*<nd [^>]*>//g' \
    | sed -r '/^\s*$/d' > MyFile.osm

The 1st sed removes the <nd...> elements.
The 2nd sed just removes the empty lines

Peter VARGA
  • 121
  • 6