From 9a7615b08e7d65dc07179adc1f65328aa5ed679d Mon Sep 17 00:00:00 2001 From: FILLAU Jean-Maxime Date: Tue, 6 Dec 2016 19:01:10 +0100 Subject: [PATCH] Adding a new command line option osrm-extract --with-osm-metadata This keep the metadata reader flag disabled by default unless explicitly specified. Signed-off-by: FILLAU Jean-Maxime --- include/extractor/extractor_config.hpp | 2 ++ src/extractor/extractor.cpp | 2 +- src/tools/extract.cpp | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/extractor/extractor_config.hpp b/include/extractor/extractor_config.hpp index 5e15e76fadc..667f09603f0 100644 --- a/include/extractor/extractor_config.hpp +++ b/include/extractor/extractor_config.hpp @@ -102,6 +102,8 @@ struct ExtractorConfig bool generate_edge_lookup; std::string edge_penalty_path; std::string edge_segment_lookup_path; + + bool use_metadata; }; } } diff --git a/src/extractor/extractor.cpp b/src/extractor/extractor.cpp index 28285421751..1b7f46cca42 100644 --- a/src/extractor/extractor.cpp +++ b/src/extractor/extractor.cpp @@ -130,7 +130,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment) auto extractor_callbacks = std::make_unique(extraction_containers); const osmium::io::File input_file(config.input_path.string()); - osmium::io::Reader reader(input_file, osmium::io::read_meta::no); + osmium::io::Reader reader(input_file, (config.use_metadata ? osmium::io::read_meta::yes : osmium::io::read_meta::no)); const osmium::io::Header header = reader.header(); unsigned number_of_nodes = 0; diff --git a/src/tools/extract.cpp b/src/tools/extract.cpp index bd0b255d1bc..61bb2df7008 100644 --- a/src/tools/extract.cpp +++ b/src/tools/extract.cpp @@ -50,7 +50,12 @@ return_code parseArguments(int argc, char *argv[], extractor::ExtractorConfig &e boost::program_options::value(&extractor_config.small_component_size) ->default_value(1000), "Number of nodes required before a strongly-connected-componennt is considered big " - "(affects nearest neighbor snapping)"); + "(affects nearest neighbor snapping)")( + "with-osm-metadata", + boost::program_options::value(&extractor_config.use_metadata) + ->implicit_value(true) + ->default_value(false), + "Use metada during osm parsing (This can affect the extraction performance)."); // hidden options, will be allowed on command line, but will not be // shown to the user