I'm trying to query OpenStreetMaps through the Overpass API.
What I want to query is roads inside a bounding box that has any kind of bridges crossing above, like railway bridges etc.
I found this example, that does just about what I need: http://maxheight.bplaced.net/overpass/map.html
So, the queries I've got look like this:
Railway bridges View in Overpass Turbo
<osm-script output="json" timeout="25">
<!-- Railway bridges -->
<query type="way">
<has-kv k="bridge" regv="^(yes|viaduct)$"/>
<has-kv k="railway" />
<bbox-query {{bbox}}/>
</query>
<!-- Find roads below the above railway bridges -->
<query type="way">
<around radius="0" />
<has-kv k="highway" regv="^((primary|secondary|tertiary|trunk)(_link)?|service|residential|unclassified)$"/>
<has-kv k="maxheight" modv="not" regv="." />
<has-kv k="maxheight:physical" modv="not" regv="." />
<has-kv k="tunnel" modv="not" regv="." />
</query>
<union>
<item />
<recurse type="way-node"/>
</union>
<!-- print results -->
<print mode="body"/>
<recurse type="down"/>
<print mode="skeleton" order="quadtile"/>
</osm-script>
Other briges View in Overpass Turbo
<osm-script output="json" timeout="25">
<!-- Bridges -->
<query type="way">
<has-kv k="bridge" regv="^(yes|viaduct)$"/>
<has-kv k="railway" modv="not" regv="." />
<bbox-query {{bbox}}/>
</query>
<!-- Find roads below the above bridges -->
<query type="way">
<around radius="0" />
<has-kv k="highway" regv="^((primary|secondary|tertiary|trunk)(_link)?|service|residential|unclassified)$"/>
<has-kv k="maxheight" modv="not" regv="." />
<has-kv k="maxheight:physical" modv="not" regv="." />
<has-kv k="tunnel" modv="not" regv="." />
</query>
<union>
<item />
<recurse type="way-node"/>
</union>
<!-- print results -->
<print mode="body"/>
<recurse type="down"/>
<print mode="skeleton" order="quadtile"/>
</osm-script>
The problem is the second query. It should find bridges crossing a road, and the accompanying road below.
What it does now is return all bridges, except railway bridges - which means it highlights a road with a bike path underneath, a road crossing a lake - which it shouldn't.
I noticed this today, when I drove past a location it highlighted and saw that it was just a bike path under the road.