@@ -672,19 +672,24 @@ void output_flex_t::write_column(
672672 if (ltype == LUA_TUSERDATA) {
673673 auto const *const geom = unpack_geometry (lua_state (), -1 );
674674 if (geom && !geom->is_null ()) {
675+ auto const type = column.type ();
676+ bool const wrap_multi =
677+ (type == table_column_type::multipoint ||
678+ type == table_column_type::multilinestring ||
679+ type == table_column_type::multipolygon);
675680 if (geom->srid () == column.srid ()) {
676681 // OSM id not available here, so use dummy 0, it is used
677682 // for debug messages only anyway.
678683 m_expire.from_geometry (*geom, 0 );
679- copy_mgr->add_hex_geom (geom_to_ewkb (*geom));
684+ copy_mgr->add_hex_geom (geom_to_ewkb (*geom, wrap_multi ));
680685 } else {
681686 auto const proj =
682687 reprojection::create_projection (column.srid ());
683688 auto const tgeom = geom::transform (*geom, *proj);
684689 // OSM id not available here, so use dummy 0, it is used
685690 // for debug messages only anyway.
686691 m_expire.from_geometry (tgeom, 0 );
687- copy_mgr->add_hex_geom (geom_to_ewkb (tgeom));
692+ copy_mgr->add_hex_geom (geom_to_ewkb (tgeom, wrap_multi ));
688693 }
689694 } else {
690695 write_null (copy_mgr, column);
0 commit comments