Add an option to vary the level of line and polygon simplification

This commit is contained in:
Eric Fischer
2016-07-12 16:51:56 -07:00
parent cb45f1c3bd
commit 9908db5e56
9 changed files with 4059 additions and 11 deletions
+12 -2
View File
@@ -55,6 +55,7 @@ static int min_detail = 7;
int quiet = 0;
int geometry_scale = 0;
double simplification = 1;
int prevent[256];
int additional[256];
@@ -1606,7 +1607,7 @@ int read_input(std::vector<source> &sources, char *fname, const char *layername,
}
unsigned midx = 0, midy = 0;
int written = traverse_zooms(fd, size, meta, stringpool, &midx, &midy, layernames, maxzoom, minzoom, basezoom, outdb, droprate, buffer, fname, tmpdir, gamma, nlayers, full_detail, low_detail, min_detail, meta_off, pool_off, initial_x, initial_y);
int written = traverse_zooms(fd, size, meta, stringpool, &midx, &midy, layernames, maxzoom, minzoom, basezoom, outdb, droprate, buffer, fname, tmpdir, gamma, nlayers, full_detail, low_detail, min_detail, meta_off, pool_off, initial_x, initial_y, simplification);
if (maxzoom != written) {
fprintf(stderr, "\n\n\n*** NOTE TILES ONLY COMPLETE THROUGH ZOOM %d ***\n\n\n", written);
@@ -1764,6 +1765,7 @@ int main(int argc, char **argv) {
{"prevent", required_argument, 0, 'p'},
{"additional", required_argument, 0, 'a'},
{"projection", required_argument, 0, 's'},
{"simplification", required_argument, 0, 'S'},
{"exclude-all", no_argument, 0, 'X'},
{"force", no_argument, 0, 'f'},
@@ -1812,7 +1814,7 @@ int main(int argc, char **argv) {
}
}
while ((i = getopt_long(argc, argv, "n:l:z:Z:B:d:D:m:o:x:y:r:b:t:g:p:a:XfFqvPL:A:s:", long_options, NULL)) != -1) {
while ((i = getopt_long(argc, argv, "n:l:z:Z:B:d:D:m:o:x:y:r:b:t:g:p:a:XfFqvPL:A:s:S:", long_options, NULL)) != -1) {
switch (i) {
case 0:
break;
@@ -1983,6 +1985,14 @@ int main(int argc, char **argv) {
set_projection_or_exit(optarg);
break;
case 'S':
simplification = atof(optarg);
if (simplification <= 0) {
fprintf(stderr, "%s: --simplification must be > 0\n", argv[0]);
exit(EXIT_FAILURE);
}
break;
default: {
int width = 7 + strlen(argv[0]);
fprintf(stderr, "Usage: %s", argv[0]);