Filtering intersections to (4-way intersections, T-junctions, and other ) using Overpass API in a given bounding box

亡梦爱人 提交于 2020-02-01 09:35:23

问题


There is a script Here that can process the data from OSM to detect intersections in a given bounding box. It works by getting all the ways in a given bounding box and then finding other ways that share common nodes with these roads. Here is the query that does that,

way
  ["highway"]
  ["highway"!~"footway|cycleway|path|service|track|proposed"]
  (, , , )
  ->.relevant_ways;
foreach.relevant_ways->.this_way{
  node(w.this_way)->.this_ways_nodes;
  way(bn.this_ways_nodes)->.linked_ways;
  way.linked_ways
    ["highway"]
    ["highway"!~"footway|cycleway|path|service|track|proposed"]
    ->.linked_ways;
    (
        .linked_ways->.linked_ways;
        -
        .this_way->.this_way;
    )->.linked_ways_only;
    node(w.linked_ways_only)->.linked_ways_only_nodes;
    node.linked_ways_only_nodes.this_ways_nodes;
    out;
}

This query returns all kinds of intersections (4-way intersections, T-junctions, ... ).

Question: Is there a way to further filter out the intersection to 4-way intersections and T-junctions?

One idea I have is to check if the common node is an endpoint of one the ways, which makes the intersection and if the common node is in the middle of the road it will be a 4-way intersection. But I am not sure how to write a query that does this.

Any help will be appreciated, Thanks.

来源:https://stackoverflow.com/questions/58478621/filtering-intersections-to-4-way-intersections-t-junctions-and-other-using

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!