@@ -473,9 +473,8 @@ void flex_write_column(lua_State *lua_state,
473473 expire->from_geometry_if_3857 (*geom);
474474 copy_mgr->add_hex_geom (geom_to_ewkb (*geom, wrap_multi));
475475 } else {
476- auto const proj =
477- reprojection::create_projection (column.srid ());
478- auto const tgeom = geom::transform (*geom, *proj);
476+ auto const &proj = get_projection (column.srid ());
477+ auto const tgeom = geom::transform (*geom, proj);
479478 expire->from_geometry_if_3857 (tgeom);
480479 copy_mgr->add_hex_geom (geom_to_ewkb (tgeom, wrap_multi));
481480 }
@@ -512,8 +511,7 @@ void flex_write_row(lua_State *lua_state, table_connection_t *table_connection,
512511 geom::geometry_t projected_geom;
513512 geom::geometry_t const *output_geom = &geom;
514513 if (srid && geom.srid () != srid) {
515- auto const proj = reprojection::create_projection (srid);
516- projected_geom = geom::transform (geom, *proj);
514+ projected_geom = geom::transform (geom, get_projection (srid));
517515 output_geom = &projected_geom;
518516 }
519517
@@ -543,11 +541,8 @@ void flex_write_row(lua_State *lua_state, table_connection_t *table_connection,
543541 } else if (column.srid () == srid) {
544542 area = geom::area (projected_geom);
545543 } else {
546- // XXX there is some overhead here always dynamically
547- // creating the same projection object. Needs refactoring.
548- auto const mproj =
549- reprojection::create_projection (column.srid ());
550- area = geom::area (geom::transform (geom, *mproj));
544+ auto const &mproj = get_projection (column.srid ());
545+ area = geom::area (geom::transform (geom, mproj));
551546 }
552547 copy_mgr->add_column (area);
553548 }
0 commit comments