-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix garbage coordinates when map matched route has uturn #2517
Conversation
bool uturn_off_of = | ||
next_segment && segment->edgeid != next_segment->edgeid && segment->target < 1.f; | ||
if (uturn_onto || uturn_off_of) { | ||
edge_trimming[i] = {{uturn_onto, match_results[segment->first_match_idx].lnglat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as @dnesbitt61 mentioned the match index can be -1
but only in the case that we dont need to trim. sadly the trimming datastructure is a pair and so you have to specify both first and second. in this case, one of them doesnt need to be set. to get around this i assign one at a time and rely on the default initializer to intialize the pair with false and an invalid lat lon etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should follow up on this with a test - if we can dream up how to make one. It's proved troublesome.
so the request that exposes this ends up showing this at the important part of the code:
basically it turns onto an edge and then just before reaching the end of the edge it turns around and leaves the edge. so i made a test case for this: TEST(Standalone, UturnTrimmingAsan) {
const std::string ascii_map = R"(
A--1--2--B
|
|
D--3--4--C--5--6--E
)";
const gurka::ways ways = {
{"AB", {{"highway", "primary"}}},
{"BC", {{"highway", "primary"}}},
{"DCE", {{"highway", "primary"}}},
};
const auto layout = gurka::detail::map_to_coordinates(ascii_map, 10);
auto map = gurka::buildtiles(layout, ways, {}, {}, "test/data/uturn_asan");
auto result =
gurka::match(map, {"2", "6", "3"}, "through", "auto", R"({"penalize_immediate_uturn":false})");
} But it doesnt expose the same problem.. |
const auto layout = gurka::detail::map_to_coordinates(ascii_map, 10); | ||
auto map = gurka::buildtiles(layout, ways, {}, {}, "test/data/uturn_asan"); | ||
|
||
auto result = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the result be checked?
fixes #2442