OSMFilter : how to filter ways that contain a node

The equivalent of HTTP API : /node/{nodeid}/ways
I would like to do the same, but off line :wink:


Ok, I contacted Markus to see if he can do something or tell me what to do.

But until that, I found a workaround :
I replaced the [<nd ref=] of each node of each way by [<t k=β€œnd” v=]
then I can use osmfilter to find ways that contain a node

Ok, I know, it is not respectful of the OSM norm, but it is a solution to my problem.
My next try when I will have time (except if Markus does it) is to not change the original osm file, but modify osmfilter to do the β€œsame” in background, without telling us, just to answer to a question :
give me all ways that have this node inside.

Regards, and thanks for this wonderfull project that is OSM.

Hello – we both found a kind of work-around:

First, create a file with just the ways in it:

osmconvert all.pbf --drop-nodes --drop-relations -o=ways.o5m

Then, get the requested ways:

echo β€˜β€™ | osmconvert -b=-180.1,-90.1,180.1,90.1 --drop-nodes - ways.o5m -o=selected_ways.osm

Maybe this will help other people too. :slight_smile:

Overpass API might come in handy for this kind of query: http://overpass-turbo.eu/s/5dq

node(245415);(way(bn);>;);out meta;

This works also offline, if you set up your own Overpass API instance.