mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-06 18:35:41 +02:00
Allow multiple tile features to have the same join key
This commit is contained in:
+7
-5
@@ -92,7 +92,7 @@ std::vector<std::vector<std::map<std::string, mvt_value>>> get_joined_rows(sqlit
|
||||
std::string query = s;
|
||||
sqlite3_free((void *) s);
|
||||
|
||||
std::map<std::string, size_t> key_to_row;
|
||||
std::multimap<std::string, size_t> key_to_row;
|
||||
for (size_t i = 0; i < join_keys.size(); i++) {
|
||||
const mvt_value &v = join_keys[i];
|
||||
|
||||
@@ -129,13 +129,14 @@ std::vector<std::vector<std::map<std::string, mvt_value>>> get_joined_rows(sqlit
|
||||
if (count > 0) {
|
||||
// join key is 0th column of query
|
||||
std::string key = (const char *) sqlite3_column_text(stmt, 0);
|
||||
auto f = key_to_row.find(key);
|
||||
if (f == key_to_row.end()) {
|
||||
auto f = key_to_row.equal_range(key);
|
||||
if (f.first == f.second) {
|
||||
fprintf(stderr, "Unexpected join key: %s\n", key.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ret[f->second].size() < join_count_limit) {
|
||||
for (auto ff = f.first; ff != f.second; ++ff) {
|
||||
if (ret[ff->second].size() < join_count_limit) {
|
||||
for (int i = 1; i < count; i++) {
|
||||
int type = sqlite3_column_type(stmt, i);
|
||||
mvt_value v;
|
||||
@@ -151,7 +152,8 @@ std::vector<std::vector<std::map<std::string, mvt_value>>> get_joined_rows(sqlit
|
||||
row.emplace(name, v);
|
||||
}
|
||||
|
||||
ret[f->second].push_back(std::move(row));
|
||||
ret[ff->second].push_back(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user