@@ -67,7 +67,7 @@ void output_pgsql_t::pgsql_out_way(osmium::Way const &way, taglist_t *tags,
6767
6868 auto const wkb = geom_to_ewkb (projected_geom);
6969 if (!wkb.empty ()) {
70- m_expire.from_geometry (projected_geom);
70+ m_expire.from_geometry_if_3857 (projected_geom);
7171 if (m_enable_way_area) {
7272 double const area = calculate_area (
7373 get_options ()->reproject_area , geom, projected_geom);
@@ -82,7 +82,7 @@ void output_pgsql_t::pgsql_out_way(osmium::Way const &way, taglist_t *tags,
8282 auto const geoms = geom::split_multi (geom::segmentize (
8383 geom::transform (geom::create_linestring (way), *m_proj), split_at));
8484 for (auto const &sgeom : geoms) {
85- m_expire.from_geometry (sgeom);
85+ m_expire.from_geometry_if_3857 (sgeom);
8686 auto const wkb = geom_to_ewkb (sgeom);
8787 m_tables[t_line]->write_row (way.id (), *tags, wkb);
8888 if (roads) {
@@ -169,7 +169,7 @@ void output_pgsql_t::node_add(osmium::Node const &node)
169169 }
170170
171171 auto const geom = geom::transform (geom::create_point (node), *m_proj);
172- m_expire.from_geometry (geom);
172+ m_expire.from_geometry_if_3857 (geom);
173173 auto const wkb = geom_to_ewkb (geom);
174174 m_tables[t_point]->write_row (node.id (), outtags, wkb);
175175}
@@ -272,7 +272,7 @@ void output_pgsql_t::pgsql_process_relation(osmium::Relation const &rel)
272272 }
273273 auto const geoms = geom::split_multi (std::move (projected_geom));
274274 for (auto const &sgeom : geoms) {
275- m_expire.from_geometry (sgeom);
275+ m_expire.from_geometry_if_3857 (sgeom);
276276 auto const wkb = geom_to_ewkb (sgeom);
277277 m_tables[t_line]->write_row (-rel.id (), outtags, wkb);
278278 if (roads) {
@@ -288,7 +288,7 @@ void output_pgsql_t::pgsql_process_relation(osmium::Relation const &rel)
288288 !get_options ()->enable_multi );
289289 for (auto const &sgeom : geoms) {
290290 auto const projected_geom = geom::transform (sgeom, *m_proj);
291- m_expire.from_geometry (projected_geom);
291+ m_expire.from_geometry_if_3857 (projected_geom);
292292 auto const wkb = geom_to_ewkb (projected_geom);
293293 if (m_enable_way_area) {
294294 double const area = calculate_area (
@@ -325,8 +325,12 @@ void output_pgsql_t::relation_add(osmium::Relation const &rel)
325325 * contain the change for that also. */
326326void output_pgsql_t::node_delete (osmid_t osm_id)
327327{
328- auto const results = m_tables[t_point]->get_wkb (osm_id);
329- if (expire_from_result (&m_expire, results) != 0 ) {
328+ if (m_expire.enabled ()) {
329+ auto const results = m_tables[t_point]->get_wkb (osm_id);
330+ if (expire_from_result (&m_expire, results) != 0 ) {
331+ m_tables[t_point]->delete_row (osm_id);
332+ }
333+ } else {
330334 m_tables[t_point]->delete_row (osm_id);
331335 }
332336}
@@ -336,8 +340,12 @@ void output_pgsql_t::delete_from_output_and_expire(osmid_t id)
336340 m_tables[t_roads]->delete_row (id);
337341
338342 for (auto table : {t_line, t_poly}) {
339- auto const results = m_tables[table]->get_wkb (id);
340- if (expire_from_result (&m_expire, results) != 0 ) {
343+ if (m_expire.enabled ()) {
344+ auto const results = m_tables[table]->get_wkb (id);
345+ if (expire_from_result (&m_expire, results) != 0 ) {
346+ m_tables[table]->delete_row (id);
347+ }
348+ } else {
341349 m_tables[table]->delete_row (id);
342350 }
343351 }
0 commit comments