UrbanAnalyst / dodgr

Distances on Directed Graphs in R
https://urbananalyst.github.io/dodgr/
128 stars 16 forks source link

Doubt over disstance calculation on a weighted streetnet with turn penalty #218

Closed xtimbeau closed 1 year ago

xtimbeau commented 1 year ago

Hi, running some consistency checks on distances produced by dodgr I came on something that's bothering me :

I calculated a weighted network using turn penalty from a downloaded silicate OSM, using dodgr::weight_streetnet( wt_profile = "motorcar"). I then run distance calculation using dodgr_dists on that network. Then I take one pair and calculate the path using dodgr_path() and th e same network. Turns out I get a decent path between the points following the OSM network as expected and displayed on the image.

Then, I get the data from the graph for each point of the path and then I calculate distance (ddd) between each line and the lagged one. When summing d (calculated by dodgr), I do not get the one returned by dodgr::dodgr_dists while summing d over the path gives a better looking value. Using another routing system (r5), in this specific case, I get for sum(d) 7,646, sum(ddd) 7,631, from dodgr::dodgr_dists 12,297 and from r5 8,027.

image

It is a little bit complicated to reproduce this example (need to download the data, calculate the streetnet, and so on). I can work out something if you need it, but I think there is something strange there, isn't it ?

xtimbeau commented 1 year ago

My bad, r5 and dodgr results were swapped. Looks like dodgr is perfectly correct there.