2

i am trying to get lat/lon of base and adj node of an EdgeIteratorState e. I am routing and getting the paths from the routing request. From the Path objects i get the EdgeIteratorStates.

I do it like so:

double lat = this.getGraphHopperStorage().getNodeAccess().getLatitude(e.getBaseNode());
double lon = this.getGraphHopperStorage().getNodeAccess().getLongitude(e.getBaseNode());
double latadj = this.getGraphHopperStorage().getNodeAccess().getLatitude(e.getAdjNode());
double lonadj = this.getGraphHopperStorage().getNodeAccess().getLongitude(e.getAdjNode());

This works for most edges. But in some cases (2 times per route calculation) I get edges with short lengths of some meters which but one of the two nodes lies 1000 km away.

An example:

edgeid: 23883882 base: 53.45419410886304, 10.13771746615434; adj: 47.80398136684257, 10.344953879973751; length of edge: 75.45741857808768 m speed: 45.0 waygeometry: (47.80348739333795,10.34522731628777,741.0), (47.80375542798092,10.345045708381662,741.0), (47.80398136684257,10.344953879973751,733.0)

What i am doing wrong? Is there another way to query the nodes attributes?

obab
  • 75
  • 1
  • 6

1 Answers1

1

Do you eventually mean the problem with virtual nodes? Are the edgestates coming from an algorithm feeded with the QueryGraph?

Instead of the 'graph storage' you would need this 'query graph' to answer these requests properly.

Also we should fail for those requests instead of silently allowing them, see the issue here: https://github.com/graphhopper/graphhopper/issues/642

Karussell
  • 17,085
  • 16
  • 97
  • 197
  • yes, i calculate the paths by Graphhopper.calcPaths(req, res). On this pathList i execute calcEdges() to get the EdgeIteratorStates. The first and the last edge has the wrong nodes. I solved my problem by removing these edges and doing an QueryResult -> getClosestEdge() for the start and end point instead. Are these two edges the virtual edges? Thank you! – obab Mar 04 '16 at 12:44
  • Yes, introduced between two junctions depending on the request. – Karussell Mar 04 '16 at 15:33
  • The virtual node thing is now better explained in the docs: https://github.com/graphhopper/graphhopper/blob/master/docs/core/low-level-api.md#what-are-virtual-edges-and-nodes – Karussell Mar 10 '16 at 12:27