Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If one doesn't mind a few false positives the following Overpass API script gets road intersections out of OpenStreetMap data pretty easily:</p> <p><a href="http://overpass-turbo.eu/s/QD" rel="nofollow noreferrer">http://overpass-turbo.eu/s/QD</a></p> <p>(the script can't detect false intersections – where only two lines meet, though, e.g. when a road is represented by multiple way objects in the OSM data)</p> <p><em>In case that the script goes offline a more readable version directly here:</em></p> <ul> <li>Dependent on which kind of ways you are interested in, add the types of ways which should not count as intersection to the <em>regv</em> attribute (at two script sections). The type of ways can be found here: <a href="https://wiki.openstreetmap.org/wiki/Key:highway" rel="nofollow noreferrer">highway tags</a>.</li> <li>The BoundingBox is the part of the map you are viewing on the Overpass-tourbo Website.</li> </ul> <p><strong>Sample Script:</strong></p> <pre><code>&lt;!-- Only select the type of ways you are interested in --&gt; &lt;query type="way" into="relevant_ways"&gt; &lt;has-kv k="highway"/&gt; &lt;has-kv k="highway" modv="not" regv="footway|cycleway|path|service|track"/&gt; &lt;bbox-query {{bbox}}/&gt; &lt;/query&gt; &lt;!-- Now find all intersection nodes for each way independently --&gt; &lt;foreach from="relevant_ways" into="this_way"&gt; &lt;!-- Get all ways which are linked to this way --&gt; &lt;recurse from="this_way" type="way-node" into="this_ways_nodes"/&gt; &lt;recurse from="this_ways_nodes" type="node-way" into="linked_ways"/&gt; &lt;!-- Again, only select the ways you are interested in, see beginning --&gt; &lt;query type="way" into="linked_ways"&gt; &lt;item set="linked_ways"/&gt; &lt;has-kv k="highway"/&gt; &lt;has-kv k="highway" modv="not" regv="footway|cycleway|path|service|track"/&gt; &lt;/query&gt; &lt;!-- Get all linked ways without the current way --&gt; &lt;difference into="linked_ways_only"&gt; &lt;item set="linked_ways"/&gt; &lt;item set="this_way"/&gt; &lt;/difference&gt; &lt;recurse from="linked_ways_only" type="way-node" into="linked_ways_only_nodes"/&gt; &lt;!-- Return all intersection nodes --&gt; &lt;query type="node"&gt; &lt;item set="linked_ways_only_nodes"/&gt; &lt;item set="this_ways_nodes"/&gt; &lt;/query&gt; &lt;print/&gt; &lt;/foreach&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload