Don't use location cache if not needed

This commit is contained in:
Michael Krasnyk
2017-09-22 17:33:06 +02:00
parent 476bc347b4
commit 545097cf06
8 changed files with 50 additions and 14 deletions
@@ -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