From 3d22a41171985d0520c9020fc9156b3356d27d75 Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Tue, 7 Jan 2025 13:27:35 -0800 Subject: [PATCH] Adding the joined attribute should be per-feature, not per-attribute --- tile-join.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tile-join.cpp b/tile-join.cpp index 30e72f3b..14c95e8d 100644 --- a/tile-join.cpp +++ b/tile-join.cpp @@ -305,6 +305,26 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map> attributes; std::vector key_order; + if (f < joined.size()) { + if (joined[f].size() > 0) { + matched = true; + } + + for (auto const &joined_feature : joined[f]) { + for (auto const &kv : joined_feature) { + if (kv.first == attribute_for_id) { + outfeature.has_id = true; + outfeature.id = mvt_value_to_long_long(kv.second); + } else if (include.count(kv.first) || (!exclude_all && exclude.count(kv.first) == 0 && exclude_attributes.count(kv.first) == 0)) { + if (kv.second.type != mvt_null) { + attributes.insert(std::pair>(kv.first, std::pair(kv.second, mvt_value_to_serial_val(kv.second)))); + key_order.push_back(kv.first); + } + } + } + } + } + for (size_t t = 0; t + 1 < feat.tags.size(); t += 2) { const std::string &key = layer.keys[feat.tags[t]]; mvt_value &val = layer.values[feat.tags[t + 1]]; @@ -321,26 +341,6 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map 0) { - matched = true; - } - - for (auto const &joined_feature : joined[f]) { - for (auto const &kv : joined_feature) { - if (kv.first == attribute_for_id) { - outfeature.has_id = true; - outfeature.id = mvt_value_to_long_long(kv.second); - } else if (include.count(kv.first) || (!exclude_all && exclude.count(kv.first) == 0 && exclude_attributes.count(kv.first) == 0)) { - if (kv.second.type != mvt_null) { - attributes.insert(std::pair>(kv.first, std::pair(kv.second, mvt_value_to_serial_val(kv.second)))); - key_order.push_back(kv.first); - } - } - } - } - } - if (header.size() > 0 && key == header[0]) { std::map>::iterator ii = mapping.find(sv.s);