Add option to remove geometry in tile-join (#382)

add option to remove geometry in `tile-join`

Co-authored-by: indus <stefan.keim@posteo.de>
This commit is contained in:
Stefan Keim
2026-02-16 13:56:01 -08:00
committed by GitHub
co-authored by indus
parent d7b2892f98
commit a5805bd809
2 changed files with 43 additions and 34 deletions
+1
View File
@@ -407,6 +407,7 @@ std::string mvt_tile::encode() {
std::string feature_string; std::string feature_string;
protozero::pbf_writer feature_writer(feature_string); protozero::pbf_writer feature_writer(feature_string);
if (layers[i].features[f].type >= 0)
feature_writer.add_enum(3, layers[i].features[f].type); feature_writer.add_enum(3, layers[i].features[f].type);
std::vector<unsigned> sorted_tags = layers[i].features[f].tags; std::vector<unsigned> sorted_tags = layers[i].features[f].tags;
+8
View File
@@ -56,6 +56,7 @@ int minzoom = 0;
std::map<std::string, std::string> renames; std::map<std::string, std::string> renames;
bool exclude_all = false; bool exclude_all = false;
bool exclude_all_tile_attributes = false; bool exclude_all_tile_attributes = false;
bool exclude_all_tile_geometries = false;
std::vector<std::string> unidecode_data; std::vector<std::string> unidecode_data;
bool want_overzoom = false; bool want_overzoom = false;
@@ -323,6 +324,9 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
} }
} }
if (exclude_all_tile_geometries) {
outfeature.type = -1;
} else {
outfeature.type = feat.type; outfeature.type = feat.type;
outfeature.geometry = feat.geometry; outfeature.geometry = feat.geometry;
@@ -361,6 +365,7 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
maxx2 = std::max(maxx2, gx); maxx2 = std::max(maxx2, gx);
} }
} }
}
features_added++; features_added++;
features_added_to_layer = true; features_added_to_layer = true;
@@ -1309,6 +1314,7 @@ int main(int argc, char **argv) {
{"exclude-all", no_argument, 0, 'X'}, {"exclude-all", no_argument, 0, 'X'},
{"include", required_argument, 0, 'y'}, {"include", required_argument, 0, 'y'},
{"exclude-all-tile-attributes", no_argument, 0, '~'}, {"exclude-all-tile-attributes", no_argument, 0, '~'},
{"exclude-all-tile-geometries", no_argument, 0, '~'},
{"layer", required_argument, 0, 'l'}, {"layer", required_argument, 0, 'l'},
{"exclude-layer", required_argument, 0, 'L'}, {"exclude-layer", required_argument, 0, 'L'},
{"quiet", no_argument, 0, 'q'}, {"quiet", no_argument, 0, 'q'},
@@ -1507,6 +1513,8 @@ int main(int argc, char **argv) {
unidecode_data = read_unidecode(optarg); unidecode_data = read_unidecode(optarg);
} else if (strcmp(opt, "exclude-all-tile-attributes") == 0) { } else if (strcmp(opt, "exclude-all-tile-attributes") == 0) {
exclude_all_tile_attributes = true; exclude_all_tile_attributes = true;
} else if (strcmp(opt, "exclude-all-tile-geometries") == 0) {
exclude_all_tile_geometries = true;
} 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);