Skip to content

Commit 77402d3

Browse files
committed
Don't process objects without tags in outputs in append mode
These were already not processed in create mode. In append mode we do need to remove any rows with those ids in the output tables, but we don't have to create new rows in any tables.
1 parent b6ab0c6 commit 77402d3

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/osmdata.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,31 @@ void osmdata_t::relation_add(osmium::Relation const &rel) const
145145

146146
void osmdata_t::node_modify(osmium::Node const &node) const
147147
{
148-
m_output->node_modify(node);
148+
if (m_with_extra_attrs || !node.tags().empty()) {
149+
m_output->node_modify(node);
150+
} else {
151+
m_output->node_delete(node.id());
152+
}
149153
m_dependency_manager->node_changed(node.id());
150154
}
151155

152156
void osmdata_t::way_modify(osmium::Way *way) const
153157
{
154-
m_output->way_modify(way);
158+
if (m_with_extra_attrs || !way->tags().empty()) {
159+
m_output->way_modify(way);
160+
} else {
161+
m_output->way_delete(way->id());
162+
}
155163
m_dependency_manager->way_changed(way->id());
156164
}
157165

158166
void osmdata_t::relation_modify(osmium::Relation const &rel) const
159167
{
160-
m_output->relation_modify(rel);
168+
if (m_with_extra_attrs || !rel.tags().empty()) {
169+
m_output->relation_modify(rel);
170+
} else {
171+
m_output->relation_delete(rel.id());
172+
}
161173
}
162174

163175
void osmdata_t::node_delete(osmid_t id) const

tests/test-parse-osmium.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ TEST_CASE("parse diff file")
205205
output, "008-ch.osc.gz", false);
206206

207207
REQUIRE(output->node.added == 0);
208-
REQUIRE(output->node.modified == 1176);
209-
REQUIRE(output->node.deleted == 16773);
208+
REQUIRE(output->node.modified == 153);
209+
REQUIRE(output->node.deleted == 17796);
210210
REQUIRE(output->way.added == 0);
211211
REQUIRE(output->way.modified == 161);
212212
REQUIRE(output->way.deleted == 4);

0 commit comments

Comments
 (0)