NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I am developing a sampling technique to do quality assurance checks. One of the things I need for the technique is to find the amount of dead end roads in a certain area. How can this be achieved? I have looked at using JOSM and Overpass-Turbo but I haven't been successful so far. Any help would be appreciated.

asked 14 Jul '15, 10:45

BmanS's gravatar image

BmanS
56447
accept rate: 0%


When you load data into GraphHopper you can use the following Java snippet to calculate all coordinates of dead ends in the whole area and do further analysis:

    CmdArgs args = CmdArgs.read(strs);
    GraphHopper hopper = new GraphHopper().init(args);
    hopper.importOrLoad();
    Graph graph = hopper.getGraph();
    NodeAccess nodeAccess = graph.getNodeAccess();
    AllEdgesIterator iter = graph.getAllEdges();
    EdgeExplorer explorer = graph.createEdgeExplorer();
    List<GHPoint> deadEndPoints = new ArrayList<>();
    while (iter.next())
    {
        int node = iter.getAdjNode();

        // an edge is a connection from junction to junction
        // so if you count all edges from a certain junction
        // and it is exactly 1 you have found a dead end
        if (GHUtility.count(explorer.setBaseNode(node)) == 1)
        {
            deadEndPoints.add(new GHPoint(nodeAccess.getLat(node), nodeAccess.getLon(node)));
        }
        node = iter.getBaseNode();
        if (GHUtility.count(explorer.setBaseNode(node)) == 1)
        {
            deadEndPoints.add(new GHPoint(nodeAccess.getLat(node), nodeAccess.getLon(node)));
        }
    }
    System.out.println(deadEndPoints);
    hopper.close();
permanent link

answered 23 Jul '15, 10:21

peatar's gravatar image

peatar
3512312
accept rate: 8%

You could load the road network data into QGIS and then find dangles

permanent link

answered 14 Jul '15, 15:18

joost%20schouppe's gravatar image

joost schouppe
3.4k245087
accept rate: 12%

Would also be possible, in QGIS, to find roads that intersect but have no node meaning there is no junction between the roads? and to find all the unnamed roads?

(14 Jul '15, 20:53) BmanS

Unnamed roads would be straightforward: you could open the attribute table and select roads with an empty name column. Or you can do the same with a simple query. It would require converting your osm data to a format with a limited number of attributes (like for example a shapefile). I'm not sure on the details of finding the missing nodes, but it will probably not be that hard with the "intersect" tool. If you get that far, ask at e.g. gis.stackexchange.com

(15 Jul '15, 07:13) joost schouppe

The pgsnapshot schema from osmosis should be able to help here. You get a SQL version of the OSM data model, and can write SQL queries to find nodes that are only at the start or end of an OSM way with the tags that you want.

permanent link

answered 14 Jul '15, 11:15

rorym's gravatar image

rorym
5.4k1449100
accept rate: 11%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×622
×23
×18
×11

question asked: 14 Jul '15, 10:45

question was seen: 13,224 times

last updated: 23 Jul '15, 10:21

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum