Accuracy of virtual edge distances

Hi,

I have the following situation: There is a windy long mountain road from A to B that consists of a single edge with 4000m lengths, A----B
I am routing from the tower node A to the tower node B and it results in the exact distance of 4000m at node B.
However, I now query a point on the graph, that is not relevant to this specific routing request, and it is snapped to the edge A----B, so that this edge now has a virtual node V, A--V--B.
As the virtual edge iterator with base node A ignores the original edge A----B, now the routing for the connection between A and B goes via V.
The problem is that this distance is actually smaller by about 2.5m, so 3997,5m. I am not using elevation.

There are only very few out of thousands of test cases where this discrepancy occurs. The distance over the virtual node is always smaller in total, but not by more than 3m.

My question is: Is this behavior expected? Is the distance calculation for the added virtual edges inherently inaccurate (esp. for long roads with lots of windy geometry)?

Thanks a lot
Hendrik

1 Like

This isn’t something I would expect as the virtual edges mainly just copy the geometry from the original edge. Do you have a test case reproducing this behaviour?

I cannot reproduce it on your demo servers online. The sums there seem to fit perfectly. Must be some other problem on my side then. I was just wondering if the distance calculation for the lenghts of the virtual edges was in any way inaccurate on this scale of 1m.
Thanks

Ah, ok. It could also be a problem in our older versions that is now fixed.

I was just wondering if the distance calculation for the lenghts of the virtual edges was in any way inaccurate on this scale of 1m.

No. The precision is currently very high but this might change: Store distances as integers · Issue #1663 · graphhopper/graphhopper · GitHub

Powered by Discourse