mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Add a flag to get the feature ID from the query
This commit is contained in:
+8
-1
@@ -58,6 +58,7 @@ std::vector<std::string> unidecode_data;
|
|||||||
std::string join_tile_column;
|
std::string join_tile_column;
|
||||||
std::string join_table_column;
|
std::string join_table_column;
|
||||||
std::string join_table;
|
std::string join_table;
|
||||||
|
std::string attribute_for_id;
|
||||||
|
|
||||||
bool want_overzoom = false;
|
bool want_overzoom = false;
|
||||||
int buffer = 5;
|
int buffer = 5;
|
||||||
@@ -279,7 +280,10 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
|||||||
|
|
||||||
if (f < joined.size()) {
|
if (f < joined.size()) {
|
||||||
for (auto const &kv : joined[f]) {
|
for (auto const &kv : joined[f]) {
|
||||||
if (kv.second.type != mvt_null) {
|
if (kv.first == attribute_for_id) {
|
||||||
|
outfeature.has_id = true;
|
||||||
|
outfeature.id = mvt_value_to_long_long(kv.second);
|
||||||
|
} else if (kv.second.type != mvt_null) {
|
||||||
attributes.insert(std::pair<std::string, std::pair<mvt_value, serial_val>>(kv.first, std::pair<mvt_value, serial_val>(kv.second, mvt_value_to_serial_val(kv.second))));
|
attributes.insert(std::pair<std::string, std::pair<mvt_value, serial_val>>(kv.first, std::pair<mvt_value, serial_val>(kv.second, mvt_value_to_serial_val(kv.second))));
|
||||||
key_order.push_back(kv.first);
|
key_order.push_back(kv.first);
|
||||||
matched = true;
|
matched = true;
|
||||||
@@ -1371,6 +1375,7 @@ int main(int argc, char **argv) {
|
|||||||
{"join-tile-column", required_argument, 0, '~'},
|
{"join-tile-column", required_argument, 0, '~'},
|
||||||
{"join-table-column", required_argument, 0, '~'},
|
{"join-table-column", required_argument, 0, '~'},
|
||||||
{"join-table", required_argument, 0, '~'},
|
{"join-table", required_argument, 0, '~'},
|
||||||
|
{"use-attribute-for-id", required_argument, 0, '~'},
|
||||||
|
|
||||||
{"no-tile-size-limit", no_argument, &pk, 1},
|
{"no-tile-size-limit", no_argument, &pk, 1},
|
||||||
{"no-tile-compression", no_argument, &pC, 1},
|
{"no-tile-compression", no_argument, &pC, 1},
|
||||||
@@ -1568,6 +1573,8 @@ int main(int argc, char **argv) {
|
|||||||
join_table_column = optarg;
|
join_table_column = optarg;
|
||||||
} else if (strcmp(opt, "join-tile-column") == 0) {
|
} else if (strcmp(opt, "join-tile-column") == 0) {
|
||||||
join_tile_column = optarg;
|
join_tile_column = optarg;
|
||||||
|
} else if (strcmp(opt, "use-attribute-for-id") == 0) {
|
||||||
|
attribute_for_id = optarg;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s: Unrecognized option --%s\n", argv[0], opt);
|
fprintf(stderr, "%s: Unrecognized option --%s\n", argv[0], opt);
|
||||||
exit(EXIT_ARGS);
|
exit(EXIT_ARGS);
|
||||||
|
|||||||
Reference in New Issue
Block a user