3030#include " output-flex.hpp"
3131#include " pgsql.hpp"
3232#include " pgsql-capabilities.hpp"
33+ #include " properties.hpp"
3334#include " reprojection.hpp"
3435#include " thread-pool.hpp"
3536#include " util.hpp"
@@ -1159,12 +1160,13 @@ output_flex_t::clone(std::shared_ptr<middle_query_t> const &mid,
11591160
11601161output_flex_t ::output_flex_t (std::shared_ptr<middle_query_t > const &mid,
11611162 std::shared_ptr<thread_pool_t > thread_pool,
1162- options_t const &options)
1163+ options_t const &options,
1164+ properties_t const &properties)
11631165: output_t (mid, std::move(thread_pool), options),
11641166 m_db_connection (get_options()->connection_params, "out.flex.main"),
11651167 m_copy_thread(std::make_shared<db_copy_thread_t >(options.connection_params))
11661168{
1167- init_lua (options.style );
1169+ init_lua (options.style , properties );
11681170
11691171 // If the osm2pgsql.select_relation_members() Lua function is defined
11701172 // it means we need two-stage processing which in turn means we need
@@ -1276,7 +1278,8 @@ void init_expire_output_class(lua_State *lua_state)
12761278
12771279} // anonymous namespace
12781280
1279- void output_flex_t::init_lua (std::string const &filename)
1281+ void output_flex_t::init_lua (std::string const &filename,
1282+ properties_t const &properties)
12801283{
12811284 m_lua_state.reset (luaL_newstate (),
12821285 [](lua_State *state) { lua_close (state); });
@@ -1285,6 +1288,14 @@ void output_flex_t::init_lua(std::string const &filename)
12851288
12861289 luaX_add_table_int (lua_state (), " stage" , 1 );
12871290
1291+ lua_pushstring (lua_state (), " properties" );
1292+ lua_createtable (lua_state (), 0 , (int )properties.size ());
1293+ for (auto const &property : properties) {
1294+ luaX_add_table_str (lua_state (), property.first .c_str (),
1295+ property.second .c_str ());
1296+ }
1297+ lua_rawset (lua_state (), -3 );
1298+
12881299 luaX_add_table_func (lua_state (), " define_table" ,
12891300 lua_trampoline_app_define_table);
12901301
0 commit comments