Skip to content

Commit

Permalink
Make tippecanoe-overzoom accept filters from a file
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Dec 5, 2024
1 parent 1d81935 commit 6e44e3a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions overzoom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ int main(int argc, char **argv) {
{"output", required_argument, 0, 'o'},
{"filter-points-multiplier", no_argument, 0, 'm'},
{"feature-filter", required_argument, 0, 'j'},
{"feature-filter-file", required_argument, 0, 'J'},
{"preserve-input-order", no_argument, 0, 'o' & 0x1F},
{"accumulate-attribute", required_argument, 0, 'E'},
{"unidecode-data", required_argument, 0, 'u' & 0x1F},
Expand Down Expand Up @@ -122,6 +123,25 @@ int main(int argc, char **argv) {
filter = optarg;
break;

case 'J': {
filter = "";

FILE *f = fopen(optarg, "r");
if (f == NULL) {
perror(optarg);
exit(EXIT_OPEN);
}

char buf[2000];
size_t nread;
while ((nread = fread(buf, sizeof(char), 2000, f)) != 0) {
filter += std::string(buf, nread);
}

fclose(f);
break;
}

case 'o' & 0x1F:
preserve_input_order = true;
break;
Expand Down

0 comments on commit 6e44e3a

Please sign in to comment.