An attempt to get a pointList

Hi,
I need to get a set of points of a path obtained by Dijkstra’s algorithm, but I get the following error on the second iteration of the outer loop:
java.lang.RuntimeException: java.lang.IllegalStateException: Edge 2149 was empty when requested with node 59, array index:0, edges:221

This code:

for (int nodeFrom : nodeIdsFrom) {
    for (int nodeTo : nodeIdsTo) {
        Path path = dijkstra.calcPath(nodeFrom, nodeTo);
        if (path.isFound()) {
            PointList points = path.calcPoints();
            // do something
        }
    }
}

I get the nodes using the method:

NodeVisitor nearestNodes = new NodeVisitor();
index.query(new BBox(p.getX() - 0.02, p.getX() + 0.02, p.getY() - 0.02, p.getY() + 0.02), nearestNodes);

I really don’t understand what is causing this error

The error means that node 59 is not adjacent to edge 2149, but I think it is impossible to say what goes wrong unless you provide more of your code.

Thank you for your help.
In that case, I would like to skip such points. Is it possible to check before the application crashes with this error?
Basically, this is the main code that can have at least some impact. What exactly would you like to see? Maybe initialization of the graph?

Here is an extension of the visitor class:

private class NodeVisitor extends LocationIndex.Visitor {
        private final IntHashSet nodeIds = new IntHashSet();

        IntHashSet getNodeIds() {
            return nodeIds;
        }

        @Override
        public void onNode(int nodeId) {
            nodeIds.add(nodeId);
        }
    }

Thank you in advance for your response

Sorry, but I don’t think I can help here, because I don’t know what you are doing. Why don’t you debug your code to see what is going on? It sounds like you are using a modified graphhopper version and this is error does not occur in master?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.