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