Set base zoom if requested as part of maxzoom guessing (#63)

* Set base zoom if requested as part of maxzoom guessing

* Add a test for guessing the maxzoom of a single point

* Don't guess an excessively large maxzoom when there is only one feature

* Update changelog
This commit is contained in:
Erica Fischer
2023-01-26 15:27:06 -08:00
committed by GitHub
parent 54b47a6757
commit 3cb6e4dd5e
7 changed files with 2295 additions and 5 deletions
+15 -3
View File
@@ -2095,7 +2095,12 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
exit(EXIT_NODATA);
}
if (count > 0) {
if (count == 0 && dist_count == 0) {
maxzoom = minimum_maxzoom;
if (droprate < 0) {
droprate = 1;
}
} else if (count > 0) {
double stddev = sqrt(m2 / count);
// Geometric mean is appropriate because distances between features
@@ -2206,6 +2211,13 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
}
}
if (basezoom == -2 && basezoom_marker_width == 1) { // -Bg, not -Bg###
basezoom = maxzoom;
if (!quiet) {
fprintf(stderr, "Using base zoom of -z%d\n", basezoom);
}
}
if (maxzoom < minimum_maxzoom) {
if (!quiet) {
fprintf(stderr, "Using minimum maxzoom of -z%d\n", minimum_maxzoom);
@@ -2222,7 +2234,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
fix_dropping = true;
if (basezoom == -1) {
if (basezoom == -1) { // basezoom unspecified
basezoom = maxzoom;
}
}
@@ -3434,7 +3446,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "%s: Reducing minimum detail to match low detail %d\n", argv[0], min_detail);
}
if (basezoom == -1) {
if (basezoom == -1) { // basezoom unspecified
if (!guess_maxzoom) {
basezoom = maxzoom;
}