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

drop all nodes except nodes tagged with highway [OSM Filter]

0

Hi all, I'm using OSM filter to filter my .osm, and I want to remove each nodes besides the ones with a tag highway :

node id="120044012" lat="50.9301459" lon="1.8091746" -> I want to remove it

node id="120044014" lat="50.9295054" lon="1.8098138" -> I want to keep it
    tag k="crossing" v="uncontrolled"
    tag k="crossing_ref" v="zebra"
    tag k="highway" v="crossing"
node

I tried --keep-nodes="highway=", and --drop-nodes="highway!=" but nothing is working. How can you do that ? I'm very new to this, thank you :)

asked 15 Oct '15, 12:35

kevin_matta's gravatar image

kevin_matta
21112
accept rate: 0%


One Answer:

1

(converted a comment thread to an answer)

You need to follow the instructions on the relevant wiki page. Use

--keep= --keep-nodes=highway

If you want to also keep ways tagged with the highway tag (and use --keep-ways to that effect) then this will also add those nodes that do not have a highway tag, but are needed to construct a way with a highway tag. This can be switched off with --ignore-dependencies.

answered 19 Oct '15, 23:04

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

1

It's working fine now, thank you again. In fact I was trying to get nodes about highway and junctions between highway, so I guess I don't need any dependencies.

(15 Oct '15, 15:41) kevin_matta

Source code available on GitHub .