From a420169109f94a5f6bcfd9c48ea17e50659a5b0a Mon Sep 17 00:00:00 2001 From: FILLAU Jean-Maxime Date: Wed, 26 Jul 2017 15:57:33 +0200 Subject: [PATCH] Reintroduce location for NodeRef in luabinding --- src/extractor/scripting_environment_lua.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/extractor/scripting_environment_lua.cpp b/src/extractor/scripting_environment_lua.cpp index 87790b1fc..e63ba0c39 100644 --- a/src/extractor/scripting_environment_lua.cpp +++ b/src/extractor/scripting_environment_lua.cpp @@ -396,8 +396,12 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context) "target_restricted", &ExtractionTurn::target_restricted); - // Keep in mind .location is undefined since we're not using libosmium's location cache - context.state.new_usertype("NodeRef", "id", &osmium::NodeRef::ref); + // Keep in mind .location is available only if .pbf is preprocessed to set the location with the + // ref using osmium command "osmium add-locations-to-ways" + context.state.new_usertype( + "NodeRef", "id", &osmium::NodeRef::ref, "location", [](const osmium::NodeRef &nref) { + return nref.location(); + }); context.state.new_usertype("EdgeSource", "source_coordinate",