@@ -257,14 +257,6 @@ void flex_write_column(lua_State *lua_state,
257
257
flex_table_column_t const &column,
258
258
std::vector<expire_tiles> *expire)
259
259
{
260
- // If there is nothing on the Lua stack, then the Lua function add_row()
261
- // was called without a table parameter. In that case this column will
262
- // be set to NULL.
263
- if (lua_gettop (lua_state) == 0 ) {
264
- write_null (copy_mgr, column);
265
- return ;
266
- }
267
-
268
260
lua_getfield (lua_state, -1 , column.name ().c_str ());
269
261
int const ltype = lua_type (lua_state, -1 );
270
262
@@ -414,9 +406,6 @@ void flex_write_column(lua_State *lua_state,
414
406
lua_typename (lua_state, ltype));
415
407
}
416
408
} else if (column.is_geometry_column ()) {
417
- // If this is a geometry column, the Lua function 'insert()' was
418
- // called, because for 'add_row()' geometry columns are handled
419
- // earlier and 'write_column()' is not called.
420
409
if (ltype == LUA_TUSERDATA) {
421
410
auto const *const geom = unpack_geometry (lua_state, -1 );
422
411
if (geom && !geom->is_null ()) {
@@ -446,71 +435,10 @@ void flex_write_column(lua_State *lua_state,
446
435
throw fmt_error (" Need geometry data for geometry column '{}'." ,
447
436
column.name ());
448
437
}
449
- } else if (column.type () == table_column_type::area) {
450
- // If this is an area column, the Lua function 'insert()' was
451
- // called, because for 'add_row()' area columns are handled
452
- // earlier and 'write_column()' is not called.
453
- throw std::runtime_error{" Column type 'area' not allowed with "
454
- " 'insert()'. Maybe use 'real'?" };
455
438
} else {
456
439
throw fmt_error (" Column type {} not implemented." ,
457
440
static_cast <uint8_t >(column.type ()));
458
441
}
459
442
460
443
lua_pop (lua_state, 1 );
461
444
}
462
-
463
- void flex_write_row (lua_State *lua_state, table_connection_t *table_connection,
464
- osmium::item_type id_type, osmid_t id,
465
- geom::geometry_t const &geom, int srid,
466
- std::vector<expire_tiles> *expire)
467
- {
468
- assert (table_connection);
469
- table_connection->new_line ();
470
- auto *copy_mgr = table_connection->copy_mgr ();
471
-
472
- geom::geometry_t projected_geom;
473
- geom::geometry_t const *output_geom = &geom;
474
- if (srid && geom.srid () != srid) {
475
- projected_geom = geom::transform (geom, get_projection (srid));
476
- output_geom = &projected_geom;
477
- }
478
-
479
- for (auto const &column : table_connection->table ()) {
480
- if (column.create_only ()) {
481
- continue ;
482
- }
483
- if (column.type () == table_column_type::id_type) {
484
- copy_mgr->add_column (type_to_char (id_type));
485
- } else if (column.type () == table_column_type::id_num) {
486
- copy_mgr->add_column (id);
487
- } else if (column.is_geometry_column ()) {
488
- assert (!geom.is_null ());
489
- auto const type = column.type ();
490
- bool const wrap_multi =
491
- (type == table_column_type::multilinestring ||
492
- type == table_column_type::multipolygon);
493
- copy_mgr->add_hex_geom (geom_to_ewkb (*output_geom, wrap_multi));
494
- } else if (column.type () == table_column_type::area) {
495
- if (geom.is_null ()) {
496
- write_null (copy_mgr, column);
497
- } else {
498
- // if srid of the area column is the same as for the geom column
499
- double area = 0 ;
500
- if (column.srid () == 4326 ) {
501
- area = geom::area (geom);
502
- } else if (column.srid () == srid) {
503
- area = geom::area (projected_geom);
504
- } else {
505
- auto const &mproj = get_projection (column.srid ());
506
- area = geom::area (geom::transform (geom, mproj));
507
- }
508
- copy_mgr->add_column (area);
509
- }
510
- } else {
511
- flex_write_column (lua_state, copy_mgr, column, expire);
512
- }
513
- }
514
-
515
- copy_mgr->finish_line ();
516
- }
0 commit comments