Skip to content

Create leg_time/distance entries for duplicate via-points - #2924

Merged
easbar merged 1 commit into
masterfrom
empty_leg_path_detail
Jan 11, 2024
Merged

easbar merged 1 commit into
masterfrom
empty_leg_path_detail

Conversation

@easbar

@easbar easbar commented Jan 10, 2024 •

Copy link
Copy Markdown
Member

Fixes #2915. This makes sure there are always N+1 leg_time/distance entries for requests with N via-points, even when some locations are duplicated. The interval of the path detail is empty for duplicate locations, because there are no edges inbetween. Here is the leg_time path detail list for the test mentioned in #2915:

image

@easbar
easbar requested a review from karussell January 10, 2024 10:10
@karussell

Copy link
Copy Markdown
Member

Nice! LGTM

@easbar
easbar merged commit a12ee81 into master Jan 11, 2024
@easbar
easbar deleted the empty_leg_path_detail branch January 11, 2024 18:22
@karussell

Copy link
Copy Markdown
Member

Unfortunately I just found out there is still a problem if I add a duplicate point e.g. as the first point:

   addPoint(new GHPoint(42.509141, 1.546063)).
   addPoint(new GHPoint(42.509141, 1.546063)).
   ...

=>

! at java.base/java.util.ImmutableCollections$AbstractImmutableCollection.addAll(ImmutableCollections.java:148)
! at com.graphhopper.ResponsePath.addPathDetails(ResponsePath.java:271)
! at com.graphhopper.util.PathMerger.doWork(PathMerger.java:139)

The List.of needs to be replaced by a modifiable ArrayList (I think?)

@easbar

easbar commented Feb 22, 2024 •

Copy link
Copy Markdown
Member Author

Yes, I think you are right. The list must be modifiable indeed, I fixed it in 99e9ba3

@karussell

Copy link
Copy Markdown
Member

Nice, thank you!

This branch was previously deployed

1 inactive deployment
benchmarks — 7acfeded Deployed Jan 9, 2024 by easbar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

incorrect leg_distance entries if two stops are identical

2 participants