Don't use location cache if not needed
This commit is contained in:
@@ -453,9 +453,10 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||
osmium::io::Reader reader(
|
||||
input_file, osmium::osm_entity_bits::node | osmium::osm_entity_bits::way, read_meta);
|
||||
|
||||
// TODO: make location_cacher conditional
|
||||
const auto pipeline =
|
||||
buffer_reader(reader) & location_cacher & buffer_transformer & buffer_storage;
|
||||
scripting_environment.HasLocationDependentData() && config.use_locations_cache
|
||||
? buffer_reader(reader) & location_cacher & buffer_transformer & buffer_storage
|
||||
: buffer_reader(reader) & buffer_transformer & buffer_storage;
|
||||
tbb::parallel_pipeline(num_threads, pipeline);
|
||||
}
|
||||
|
||||
|
||||
@@ -302,6 +302,8 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
||||
[](const osmium::Way &way) { return sol::as_table(way.nodes()); },
|
||||
"get_location_tag",
|
||||
[&context](const osmium::Way &way, const char *key) {
|
||||
if (context.location_dependent_data.empty())
|
||||
return sol::object(sol::nil);
|
||||
// HEURISTIC: use a single node (last) of the way to localize the way
|
||||
// For more complicated scenarios a proper merging of multiple tags
|
||||
// at one or many locations must be provided
|
||||
|
||||
@@ -66,7 +66,12 @@ return_code parseArguments(int argc,
|
||||
boost::program_options::value<std::vector<boost::filesystem::path>>(
|
||||
&extractor_config.location_dependent_data_paths)
|
||||
->composing(),
|
||||
"GeoJSON files with location-dependent data");
|
||||
"GeoJSON files with location-dependent data")(
|
||||
"use-locations-cache",
|
||||
boost::program_options::value<bool>(&extractor_config.use_locations_cache)
|
||||
->implicit_value(true)
|
||||
->default_value(extractor_config.use_locations_cache),
|
||||
"Use internal nodes locations cache for location-dependent data lookups");
|
||||
|
||||
bool dummy;
|
||||
// hidden options, will be allowed on command line, but will not be
|
||||
|
||||
Reference in New Issue
Block a user