Repository navigation
Fix constant path details like leg_distance for very short routes with duplicate points - #3007
Conversation
|
|
||
| public Map.Entry<String, List<PathDetail>> build() { | ||
| return new MapEntry(getName(), pathDetails); | ||
| return new MapEntry<>(getName(), pathDetails); |
There was a problem hiding this comment.
We might also switch to using Map.entry(getName(), pathDetails) if we don't need mutability.
There was a problem hiding this comment.
Ok, can you explain why? Btw I only added the diamond here and this is unrelated to the PR.
There was a problem hiding this comment.
It's using a value-based class behind the scenes with all the advantages that come with it: https://www.baeldung.com/java-value-based-classes
this is unrelated to the PR.
Yep. I have a bit of a bad habit of pointing at Java 9+ goodies when I see them.
There was a problem hiding this comment.
Ok I meant my own change (adding the diamond) was already unrelated. Thanks for pointing out the Java 9+ option. But in this case I'll leave it as it is for now.
karussell
left a comment
There was a problem hiding this comment.
Thanks! LGTM.
(there is some code commented out which should be removed)
Yes, these were some consistency checks, but they still fail, because the behavior is still not consistent :) For path details other than leg_distance/weight/time we do not get an empty interval when there are duplicate points (#2924), but I'll fix this in another PR. |
We get this error:
graphhopper/core/src/main/java/com/graphhopper/util/PathSimplification.java
Line 315 in 34b333a
graphhopper/core/src/main/java/com/graphhopper/util/PathSimplification.java
Lines 183 to 185 in 34b333a
Here I fixed this by correctly setting the interval boundaries in ConstantDetailsBuilder for empty paths. c.f. the special handling we introduced for empty paths here: #2924