diff --git a/include/osm_store.h b/include/osm_store.h index de86e367..0045ab17 100644 --- a/include/osm_store.h +++ b/include/osm_store.h @@ -158,6 +158,11 @@ class RelationScanStore { const std::vector>& relations_for_relation(RelationID relId) { return relationsForRelations[relId]; } + bool has_relation_tags(RelationID relId) { + const size_t shard = relId % mutex.size(); + return relationTags[shard].find(relId) != relationTags[shard].end(); + } + const tag_map_t& relation_tags(RelationID relId) { const size_t shard = relId % mutex.size(); return relationTags[shard][relId]; diff --git a/src/pbf_processor.cpp b/src/pbf_processor.cpp index 4f6ac2c5..c540c992 100644 --- a/src/pbf_processor.cpp +++ b/src/pbf_processor.cpp @@ -299,7 +299,20 @@ bool PbfProcessor::ReadRelations( try { tags.reset(); - readTags(pbfRelation, pb, tags); + std::deque dataviews; + if (osmStore.scannedRelations.has_relation_tags(pbfRelation.id)) { + const auto& scannedTags = osmStore.scannedRelations.relation_tags(pbfRelation.id); + for (const auto& entry : scannedTags) { + dataviews.push_back({entry.first.data(), entry.first.size()}); + const auto& key = dataviews.back(); + dataviews.push_back({entry.second.data(), entry.second.size()}); + const auto& value = dataviews.back(); + tags.addTag(key, value); + } + } else { + readTags(pbfRelation, pb, tags); + } + if (osmStore.usedRelations.test(pbfRelation.id) || wayKeys.filter(tags)) output.setRelation(pb.stringTable, pbfRelation, outerWayVec, innerWayVec, tags, isMultiPolygon, isInnerOuter);