Skip to content
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 search_cutoff check in loki correlate_node #2023

Merged
merged 4 commits into from Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -2,7 +2,8 @@
* **Bug Fix**
* FIXED: Changed reachability computation to consider both directions of travel wrt candidate edges [#1965](https://github.com/valhalla/valhalla/pull/1965)
* FIXED: toss ways where access=private and highway=service and service != driveway. [#1960](https://github.com/valhalla/valhalla/pull/1960)

* FIXED: Fix search_cutoff check in loki correlate_node. [#2023](https://github.com/valhalla/valhalla/pull/2023)

* **Enhancement**
* ADDED: Establish pinpoint test pattern [#1969](https://github.com/valhalla/valhalla/pull/1969)
* ADDED: Suppress relative direction in ramp/exit instructions if it matches driving side of street [#1990](https://github.com/valhalla/valhalla/pull/1990)
Expand Down
6 changes: 3 additions & 3 deletions src/loki/search.cc
Expand Up @@ -243,6 +243,9 @@ struct bin_handler_t {
const candidate_t& candidate,
PathLocation& correlated,
std::vector<PathLocation::PathEdge>& filtered) {
// the search cutoff is a hard filter so skip any outside of that
if (candidate.point.Distance(location.latlng_) > location.search_cutoff_)
return;
// we need this because we might need to go to different levels
float distance = std::numeric_limits<float>::lowest();
std::function<void(const GraphId& node_id, bool transition)> crawl;
Expand All @@ -259,9 +262,6 @@ struct bin_handler_t {
// cache the distance
if (distance == std::numeric_limits<float>::lowest())
distance = node_ll.Distance(location.latlng_);
// the search cutoff is a hard filter so skip any outside of that
if (distance > location.search_cutoff_)
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was my screw up back when we added search_cutoff. should have thought about that a little harder at the time. apologies!

// add edges entering/leaving this node
for (const auto* edge = start_edge; edge < end_edge; ++edge) {
// get some info about this edge and the opposing
Expand Down