Merge pull request #1476 from Project-OSRM/fix/distance-based-radius
Use distance based search radius
This commit is contained in:
commit
407036e215
@ -646,7 +646,7 @@ class StaticRTree
|
||||
const FixedPointCoordinate &input_coordinate,
|
||||
std::vector<PhantomNode> &result_phantom_node_vector,
|
||||
const unsigned max_number_of_phantom_nodes,
|
||||
const unsigned max_checked_elements = 4 * LEAF_NODE_SIZE)
|
||||
const float max_distance = 1100)
|
||||
{
|
||||
unsigned inspected_elements = 0;
|
||||
unsigned number_of_elements_from_big_cc = 0;
|
||||
@ -669,6 +669,10 @@ class StaticRTree
|
||||
while (!traversal_queue.empty())
|
||||
{
|
||||
const IncrementalQueryCandidate current_query_node = traversal_queue.top();
|
||||
if (current_query_node.min_dist > max_distance)
|
||||
{
|
||||
break;
|
||||
}
|
||||
traversal_queue.pop();
|
||||
|
||||
if (current_query_node.node.template is<TreeNode>())
|
||||
@ -771,9 +775,8 @@ class StaticRTree
|
||||
}
|
||||
|
||||
// stop the search by flushing the queue
|
||||
if ((result_phantom_node_vector.size() >= max_number_of_phantom_nodes &&
|
||||
number_of_elements_from_big_cc > 0) ||
|
||||
inspected_elements >= max_checked_elements)
|
||||
if (result_phantom_node_vector.size() >= max_number_of_phantom_nodes &&
|
||||
number_of_elements_from_big_cc > 0)
|
||||
{
|
||||
traversal_queue = std::priority_queue<IncrementalQueryCandidate>{};
|
||||
}
|
||||
|
@ -57,14 +57,13 @@ Feature: Locating Nearest node on a Way - pick closest way
|
||||
|
||||
Scenario: Nearest - High lat/lon
|
||||
Given the node locations
|
||||
| node | lat | lon |
|
||||
| a | -85 | -180 |
|
||||
| b | -85 | -160 |
|
||||
| c | -85 | -140 |
|
||||
| x | 75 | -180 |
|
||||
| y | 75 | -180 |
|
||||
| v | 1 | 1 |
|
||||
| w | -1 | -1 |
|
||||
| node | lat | lon |
|
||||
| a | -85 | -180 |
|
||||
| b | -85 | -160 |
|
||||
| c | -85 | -140 |
|
||||
| x | -84.999 | -180 |
|
||||
| y | -84.999 | -160 |
|
||||
| z | -84.999 | -140 |
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
@ -73,6 +72,5 @@ Feature: Locating Nearest node on a Way - pick closest way
|
||||
When I request nearest I should get
|
||||
| in | out |
|
||||
| x | a |
|
||||
| y | a |
|
||||
| v | c |
|
||||
| w | c |
|
||||
| y | b |
|
||||
| z | c |
|
||||
|
@ -98,30 +98,26 @@ Feature: Snap start/end point to the nearest way
|
||||
| b | x | xb |
|
||||
| c | x | xc |
|
||||
|
||||
Scenario: Find edges within 1km, and the same from 10km
|
||||
Given a grid size of 1000 meters
|
||||
Scenario: Find edges within 100m, and the same from 1km
|
||||
Given a grid size of 100 meters
|
||||
Given the node map
|
||||
| p | | | | | | | | | | | i | | | | | | | | | | | j |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | 8 | | 1 | | 2 | | | | | | | | | |
|
||||
| | | | | | | | | | | h | a | b | | | | | | | | | | |
|
||||
| o | | | | | | | | | 7 | g | x | c | 3 | | | | | | | | | k |
|
||||
| | | | | | | | | | | f | e | d | | | | | | | | | | |
|
||||
| | | | | | | | | | 6 | | 5 | | 4 | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | | | | | | | |
|
||||
| n | | | | | | | | | | | m | | | | | | | | | | | l |
|
||||
| p | | | | | | | | i | | | | | | | | j |
|
||||
| | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | 8 | | 1 | | 2 | | | | | | |
|
||||
| | | | | | | | h | a | b | | | | | | | |
|
||||
| o | | | | | | 7 | g | x | c | 3 | | | | | | k |
|
||||
| | | | | | | | f | e | d | | | | | | | |
|
||||
| | | | | | | 6 | | 5 | | 4 | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | | | | | | |
|
||||
| n | | | | | | | | m | | | | | | | | l |
|
||||
|
||||
Given the ways
|
||||
| nodes |
|
||||
|
Loading…
Reference in New Issue
Block a user