Expose component size variable as command-line option (this allows testing of big/small components in cucumber tests).
Add ability to pass extra parameters to during tests. Limit distance table search so that it doesn't return any big components if they're beyond max_distance.
This commit is contained in:
parent
f3f153cb38
commit
4ddbd2efb6
@ -436,7 +436,7 @@ void extractor::FindComponents(unsigned max_edge_id,
|
|||||||
component_search.get_component_id(node.reverse_edge_based_node_id));
|
component_search.get_component_id(node.reverse_edge_based_node_id));
|
||||||
|
|
||||||
const unsigned component_size = component_search.get_component_size(forward_component);
|
const unsigned component_size = component_search.get_component_size(forward_component);
|
||||||
node.component.is_tiny = component_size < 1000;
|
node.component.is_tiny = component_size < config.small_component_size;
|
||||||
node.component.id = 1 + forward_component;
|
node.component.id = 1 + forward_component;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,11 @@ ExtractorOptions::ParseArguments(int argc, char *argv[], ExtractorConfig &extrac
|
|||||||
"Number of threads to use")(
|
"Number of threads to use")(
|
||||||
"generate-edge-lookup",boost::program_options::value<bool>(
|
"generate-edge-lookup",boost::program_options::value<bool>(
|
||||||
&extractor_config.generate_edge_lookup)->implicit_value(true)->default_value(false),
|
&extractor_config.generate_edge_lookup)->implicit_value(true)->default_value(false),
|
||||||
"Generate a lookup table for internal edge-expanded-edge IDs to OSM node pairs");
|
"Generate a lookup table for internal edge-expanded-edge IDs to OSM node pairs")(
|
||||||
|
"small-component-size",
|
||||||
|
boost::program_options::value<unsigned int>(&extractor_config.small_component_size)
|
||||||
|
->default_value(1000),
|
||||||
|
"Number of nodes required before a strongly-connected-componennt is considered big (affects nearest neighbor snapping)");
|
||||||
|
|
||||||
#ifdef DEBUG_GEOMETRY
|
#ifdef DEBUG_GEOMETRY
|
||||||
config_options.add_options()("debug-turns",
|
config_options.add_options()("debug-turns",
|
||||||
|
@ -58,6 +58,7 @@ struct ExtractorConfig
|
|||||||
std::string rtree_leafs_output_path;
|
std::string rtree_leafs_output_path;
|
||||||
|
|
||||||
unsigned requested_num_threads;
|
unsigned requested_num_threads;
|
||||||
|
unsigned small_component_size;
|
||||||
|
|
||||||
bool generate_edge_lookup;
|
bool generate_edge_lookup;
|
||||||
std::string edge_penalty_path;
|
std::string edge_penalty_path;
|
||||||
|
@ -6,6 +6,10 @@ Given(/^the import format "(.*?)"$/) do |format|
|
|||||||
set_input_format format
|
set_input_format format
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Given /^the extract extra arguments "(.*?)"$/ do |args|
|
||||||
|
set_extract_args args
|
||||||
|
end
|
||||||
|
|
||||||
Given /^a grid size of (\d+) meters$/ do |meters|
|
Given /^a grid size of (\d+) meters$/ do |meters|
|
||||||
set_grid_size meters
|
set_grid_size meters
|
||||||
end
|
end
|
||||||
|
@ -10,3 +10,7 @@ end
|
|||||||
def set_profile profile
|
def set_profile profile
|
||||||
@profile = profile
|
@profile = profile
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_extract_args args
|
||||||
|
@extract_args = args
|
||||||
|
end
|
||||||
|
@ -274,7 +274,7 @@ def extract_data
|
|||||||
Dir.chdir TEST_FOLDER do
|
Dir.chdir TEST_FOLDER do
|
||||||
log_preprocess_info
|
log_preprocess_info
|
||||||
log "== Extracting #{osm_file}.osm...", :preprocess
|
log "== Extracting #{osm_file}.osm...", :preprocess
|
||||||
unless system "#{BIN_PATH}/osrm-extract #{osm_file}.osm#{'.pbf' if pbf?} --profile #{PROFILES_PATH}/#{@profile}.lua >>#{PREPROCESS_LOG_FILE} 2>&1"
|
unless system "#{BIN_PATH}/osrm-extract #{osm_file}.osm#{'.pbf' if pbf?} #{@extract_args} --profile #{PROFILES_PATH}/#{@profile}.lua >>#{PREPROCESS_LOG_FILE} 2>&1"
|
||||||
log "*** Exited with code #{$?.exitstatus}.", :preprocess
|
log "*** Exited with code #{$?.exitstatus}.", :preprocess
|
||||||
raise ExtractError.new $?.exitstatus, "osrm-extract exited with code #{$?.exitstatus}."
|
raise ExtractError.new $?.exitstatus, "osrm-extract exited with code #{$?.exitstatus}."
|
||||||
end
|
end
|
||||||
|
@ -135,3 +135,30 @@ Feature: Basic Distance Matrix
|
|||||||
| | b | e | f |
|
| | b | e | f |
|
||||||
| a | 100 | 200 | 300 |
|
| a | 100 | 200 | 300 |
|
||||||
| b | 0 | 100 | 200 |
|
| b | 0 | 100 | 200 |
|
||||||
|
|
||||||
|
# There is a 1100m limit when searching for nearest neighbours
|
||||||
|
# so we set the grid size to something that makes it easy to
|
||||||
|
# put nodes inside/outside that limit
|
||||||
|
Scenario: Testbog - Check snapping on on small components
|
||||||
|
Given a grid size of 300 meters
|
||||||
|
Given the extract extra arguments "--small-component-size 4"
|
||||||
|
Given the node map
|
||||||
|
| a | b | | | m | | x |
|
||||||
|
| d | e | | | n | | y |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes |
|
||||||
|
| ab |
|
||||||
|
| be |
|
||||||
|
| ed |
|
||||||
|
| da |
|
||||||
|
| xy |
|
||||||
|
|
||||||
|
When I request a travel time matrix I should get
|
||||||
|
| | a | b | x | y | m | n |
|
||||||
|
| a | 0 | 300 | | | 300 | 600 |
|
||||||
|
| b | 300 | 0 | | | 0 | 300 |
|
||||||
|
| x | | | 0 | 300 | | |
|
||||||
|
| y | | | 300 | 0 | | |
|
||||||
|
| m | 300 | 0 | | | 0 | 300 |
|
||||||
|
| n | 600 | 300 | | | 300 | 0 |
|
||||||
|
Loading…
Reference in New Issue
Block a user