tedsteiner / OpenStreetMap.jl

Julia OpenStreetMap Package
Other
52 stars 18 forks source link

Distance is understated for routes that have been segmented #63

Open garborg opened 9 years ago

garborg commented 9 years ago

Because all non-intersection nodes have been removed, and the euclidian distances between remaining nodes are tallied, ignoring curves in the road.

tedsteiner commented 9 years ago

Is this true? I thought that during the segmentation the actual road distance was applied as the weight? See here: https://github.com/tedsteiner/OpenStreetMap.jl/blob/master/src/intersections.jl#L55

garborg commented 9 years ago

Graphs are constructed correctly, but getting the length of a 'fastest route' is wrong, as is measuring the length of any 'segmented'/'compressed' way yourself.

I had meant to get to this or at least brainstorm possible fixes some time ago, but I forgot until @yeesian put together those milestone issues in #62.

garborg commented 9 years ago

Actually, let me test it again to be sure it's still the case. It's been a while.

garborg commented 9 years ago

Yes, still an issue. As we calculate distance in the tests:

fastest_route, fastest_time = fastestRoute(network, node0, node1)
fastest_distance = distance(nodesENU, fastest_route)
@test length(fastest_route) == 22
@test_approx_eq fastest_distance 724.5817003198007

It calculates Euclidian distance between the nodes that haven't been removed, which is fine in the example we test, but wrong for the fastest_segment_distance, which we don't test.

tedsteiner commented 9 years ago

Yep, you're right. This is a good catch. Not sure what the best way to fix it is, though...

garborg commented 9 years ago

I can't look into it right now either, but I marked it for 0.8, just to make sure it doesn't slip through the cracks.