mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 16:35:40 +02:00
Merge remote-tracking branch 'origin/main' into tile-join-sqlite
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
# 2.72.0
|
||||
|
||||
* Add --clip-polygon-file and --feature-filter-file options to tippecanoe-overzoom
|
||||
|
||||
# 2.71.0
|
||||
|
||||
* Add --clip-bounding-box and --clip-polygon options to tippecanoe-overzoom
|
||||
|
||||
@@ -326,6 +326,11 @@ overzoom-test: tippecanoe-overzoom
|
||||
./tippecanoe-decode tests/pbf/0-0-0-pop-expr.pbf 0 0 0 > tests/pbf/0-0-0-pop-expr.pbf.json.check
|
||||
cmp tests/pbf/0-0-0-pop-expr.pbf.json.check tests/pbf/0-0-0-pop-expr.pbf.json
|
||||
rm tests/pbf/0-0-0-pop-expr.pbf tests/pbf/0-0-0-pop-expr.pbf.json.check
|
||||
# Same filter test, but reading the filter from a file
|
||||
./tippecanoe-overzoom -y NAME -J tests/pbf/scalerank-0-filter.json -o tests/pbf/0-0-0-pop-expr.pbf tests/pbf/0-0-0-pop.pbf 0/0/0 0/0/0
|
||||
./tippecanoe-decode tests/pbf/0-0-0-pop-expr.pbf 0 0 0 > tests/pbf/0-0-0-pop-expr.pbf.json.check
|
||||
cmp tests/pbf/0-0-0-pop-expr.pbf.json.check tests/pbf/0-0-0-pop-expr.pbf.json
|
||||
rm tests/pbf/0-0-0-pop-expr.pbf tests/pbf/0-0-0-pop-expr.pbf.json.check
|
||||
# Filtering with multiplier
|
||||
# 243 features in the source tile tests/pbf/0-0-0-pop.pbf
|
||||
# 8 features survive into the output, from 9 clusters of 30
|
||||
@@ -382,6 +387,11 @@ overzoom-test: tippecanoe-overzoom
|
||||
./tippecanoe-decode tests/pbf/bin-11-327-791-ids-clip.pbf.out 11 327 791 > tests/pbf/bin-11-327-791-ids-clip.pbf.out.json.check
|
||||
cmp tests/pbf/bin-11-327-791-ids-clip.pbf.out.json.check tests/pbf/bin-11-327-791-ids-clip.pbf.out.json
|
||||
rm tests/pbf/bin-11-327-791-ids-clip.pbf.out.json.check tests/pbf/bin-11-327-791-ids-clip.pbf.out
|
||||
# Binning by id, clipping by polygon from file
|
||||
./tippecanoe-overzoom -o tests/pbf/bin-11-327-791-ids-clip.pbf.out --clip-polygon-file=tests/pbf/clip-poly.json --assign-to-bins tests/pbf/sf-zips.json --bin-by-id-list bin-ids tests/pbf/yearbuilt.pbf 11/327/791 11/327/791
|
||||
./tippecanoe-decode tests/pbf/bin-11-327-791-ids-clip.pbf.out 11 327 791 > tests/pbf/bin-11-327-791-ids-clip.pbf.out.json.check
|
||||
cmp tests/pbf/bin-11-327-791-ids-clip.pbf.out.json.check tests/pbf/bin-11-327-791-ids-clip.pbf.out.json
|
||||
rm tests/pbf/bin-11-327-791-ids-clip.pbf.out.json.check tests/pbf/bin-11-327-791-ids-clip.pbf.out
|
||||
# Binning by id, attribute stripping
|
||||
# Note that it still works even if we exclude the ID that we are binning by
|
||||
./tippecanoe-overzoom -yZCTA5CE10 -ytippecanoe:count -o tests/pbf/bin-11-327-791-ids-zip.pbf.out --assign-to-bins tests/pbf/sf-zips.json --bin-by-id-list bin-ids tests/pbf/yearbuilt.pbf 11/327/791 11/327/791
|
||||
|
||||
@@ -40,6 +40,26 @@ void usage(char **argv) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
std::string read_json_file(const char *fname) {
|
||||
std::string out;
|
||||
|
||||
FILE *f = fopen(fname, "r");
|
||||
if (f == NULL) {
|
||||
perror(optarg);
|
||||
exit(EXIT_OPEN);
|
||||
}
|
||||
|
||||
char buf[2000];
|
||||
size_t nread;
|
||||
while ((nread = fread(buf, sizeof(char), 2000, f)) != 0) {
|
||||
out += std::string(buf, nread);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
const char *outtile = NULL;
|
||||
@@ -60,6 +80,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},
|
||||
@@ -72,6 +93,7 @@ int main(int argc, char **argv) {
|
||||
{"no-tile-compression", no_argument, 0, 'd' & 0x1F},
|
||||
{"clip-bounding-box", required_argument, 0, 'k' & 0x1F},
|
||||
{"clip-polygon", required_argument, 0, 'l' & 0x1F},
|
||||
{"clip-polygon-file", required_argument, 0, 'm' & 0x1F},
|
||||
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
@@ -122,6 +144,10 @@ int main(int argc, char **argv) {
|
||||
filter = optarg;
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
filter = read_json_file(optarg);
|
||||
break;
|
||||
|
||||
case 'o' & 0x1F:
|
||||
preserve_input_order = true;
|
||||
break;
|
||||
@@ -181,6 +207,12 @@ int main(int argc, char **argv) {
|
||||
break;
|
||||
}
|
||||
|
||||
case 'm' & 0x1F: {
|
||||
clipbbox clip = parse_clip_poly(read_json_file(optarg));
|
||||
clipbboxes.push_back(clip);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unrecognized flag -%c\n", i);
|
||||
usage(argv);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"coordinates":[[[-122.4527379,37.8128815],[-122.4598853,37.7834743],[-122.4280914,37.7959397],[-122.4527379,37.8128815]]],"type":"Polygon"}
|
||||
@@ -0,0 +1 @@
|
||||
{"*":["SCALERANK","eq",0]}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v2.71.0"
|
||||
#define VERSION "v2.72.0"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user