mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-06 10:25: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;
|
std::string query = s;
|
||||||
sqlite3_free((void *) 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++) {
|
for (size_t i = 0; i < join_keys.size(); i++) {
|
||||||
const mvt_value &v = join_keys[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) {
|
if (count > 0) {
|
||||||
// join key is 0th column of query
|
// join key is 0th column of query
|
||||||
std::string key = (const char *) sqlite3_column_text(stmt, 0);
|
std::string key = (const char *) sqlite3_column_text(stmt, 0);
|
||||||
auto f = key_to_row.find(key);
|
auto f = key_to_row.equal_range(key);
|
||||||
if (f == key_to_row.end()) {
|
if (f.first == f.second) {
|
||||||
fprintf(stderr, "Unexpected join key: %s\n", key.c_str());
|
fprintf(stderr, "Unexpected join key: %s\n", key.c_str());
|
||||||
continue;
|
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++) {
|
for (int i = 1; i < count; i++) {
|
||||||
int type = sqlite3_column_type(stmt, i);
|
int type = sqlite3_column_type(stmt, i);
|
||||||
mvt_value v;
|
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);
|
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