Compare commits

..
2 Commits
Author SHA1 Message Date
Erica Fischer e6d05bc317 Fix tile-join crash when trying to merge empty tilesets with --overzoom (#138)
* Fix tile-join crash when trying to merge empty tilesets with --overzoom

* Add an option not to reduce tiny polygons to dust at maxzoom

* Add test for prevention of tiny polygon reduction at maxzoom

* Change version number
2023-08-31 13:02:03 -07:00
Erica Fischer 2ec6180003 Fix "strategies" accounting for 0-length linestrings and degenerate polygons (#137)
* Dropping a 0-length feature doesn't count as dropping-as-needed

* Add an option not to reduce tiny polygons to dust at maxzoom

* Add test for prevention of tiny polygon reduction at maxzoom

* Fix accounting for tiny polygons not to include degenerate geometries

* Revert "Add test for prevention of tiny polygon reduction at maxzoom"

This reverts commit f931bbd73e.

* Revert "Add an option not to reduce tiny polygons to dust at maxzoom"

This reverts commit 03f0882bb6.

* Fix tests

* Another test that no longer has any really tiny polygons

* Oops, that broke LineString simplification

* This time for sure!

* Update changelog and version
2023-08-29 10:54:39 -07:00
50 changed files with 462 additions and 50 deletions
+9
View File
@@ -1,3 +1,12 @@
# 2.31.0
* Fix tile-join crash when trying to join empty tilesets
* Add --no-tiny-polygon-reduction-at-maximum-zoom option
# 2.30.1
* Fix spurious reports of tiny polygons and 0-length LineStrings in "strategies"
# 2.30.0
* Add --extend-zooms-if-still-dropping-maximum option
+6
View File
@@ -398,6 +398,12 @@ join-test: tile-join
./tippecanoe-decode -x generator -x generator_options -x name -x description tests/join-population/empty.pmtiles > tests/join-population/empty.out.json.check
cmp tests/join-population/empty.out.json.check tests/join-population/empty.out.json
rm -f tests/join-population/empty.pmtiles tests/join-population/empty.out.pmtiles tests/join-population/empty.out.json.check
# pmtiles again, with --overzoom
./tippecanoe -q -z0 -f -o tests/join-population/empty.pmtiles tests/join-population/empty.json
./tile-join --overzoom -f -o tests/join-population/empty.out.pmtiles tests/join-population/empty.pmtiles
./tippecanoe-decode -x generator -x generator_options -x name -x description tests/join-population/empty.pmtiles > tests/join-population/empty.out.json.check
cmp tests/join-population/empty.out.json.check tests/join-population/empty.out.json
rm -f tests/join-population/empty.pmtiles tests/join-population/empty.out.pmtiles tests/join-population/empty.out.json.check
# dirtiles:
./tippecanoe -q -z0 -f -e tests/join-population/empty.dirtiles tests/join-population/empty.json
./tile-join -f -e tests/join-population/empty.out.dirtiles tests/join-population/empty.dirtiles
+1
View File
@@ -494,6 +494,7 @@ the same layer, enclose them in an `all` expression so they will all be evaluate
* `--simplification-at-maximum-zoom=`_scale_: Use the specified _scale_ at maxzoom instead of the standard simplification scale (which still applies at lower zooms)
* `-pn` or `--no-simplification-of-shared-nodes`: Don't simplify away nodes that appear in more than one feature or are used multiple times within the same feature, so that the intersection node will not be lost from intersecting roads. (This will not be effective if you also use `--coalesce` or `--detect-shared-borders`.)
* `-pt` or `--no-tiny-polygon-reduction`: Don't combine the area of very small polygons into small squares that represent their combined area.
* `-pT` or `--no-tiny-polygon-reduction-at-maximum-zoom`: Combine the area of very small polygons into small squares that represent their combined area only at zoom levels below the maximum.
* `--tiny-polygon-size=`_size_: Use the specified _size_ for tiny polygons instead of the default 2. Anything above 6 or so will lead to visible artifacts with the default tile detail.
* `-av` or `--visvalingam`: Use Visvalingam's simplification algorithm rather than Douglas-Peucker's.
+10 -7
View File
@@ -186,14 +186,15 @@ void check_polygon(drawvec &geom) {
}
}
drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double *accum_area, serial_feature *this_feature, serial_feature *tiny_feature) {
drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *still_needs_simplification, bool *reduced_away, double *accum_area, serial_feature *this_feature, serial_feature *tiny_feature) {
drawvec out;
const double pixel = (1LL << (32 - detail - z)) * (double) tiny_polygon_size;
bool includes_real = false;
bool includes_dust = false;
*reduced = true;
bool included_last_outer = false;
*still_needs_simplification = false;
*reduced_away = false;
for (size_t i = 0; i < geom.size(); i++) {
if (geom[i].op == VT_MOVETO) {
@@ -223,9 +224,9 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
// cut out of, so we are just subtracting its area from the tiny polygon
// rather than trying to deal with it geometrically
if ((area > 0 && area <= pixel * pixel) || (area < 0 && !included_last_outer)) {
// printf("area is only %f vs %lld so using square\n", area, pixel * pixel);
*accum_area += area;
*reduced_away = true;
if (area > 0 && *accum_area > pixel * pixel) {
// XXX use centroid;
@@ -248,21 +249,23 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
// as a real geometry because otherwise we can accumulate enough tiny holes
// that we will drop the next several outer rings getting back up to 0.
else {
// printf("area is %f so keeping instead of %lld\n", area, pixel * pixel);
for (size_t k = i; k < j && k < geom.size(); k++) {
out.push_back(geom[k]);
}
// which means that the overall polygon has a real geometry,
// which means that it gets to be simplified.
*reduced = false;
*still_needs_simplification = true;
includes_real = true;
if (area > 0) {
included_last_outer = true;
}
}
} else {
// area is 0: doesn't count as either having been reduced away,
// since it was probably just degenerate from having been clipped,
// or as needing simplification, since it produces no output.
}
i = j - 1;
+1 -1
View File
@@ -68,7 +68,7 @@ drawvec clip_point(drawvec &geom, int z, long long buffer);
drawvec clean_or_clip_poly(drawvec &geom, int z, int buffer, bool clip);
drawvec simple_clip_poly(drawvec &geom, int z, int buffer);
drawvec close_poly(drawvec &geom);
drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double *accum_area, serial_feature *this_feature, serial_feature *tiny_feature);
drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *still_needs_simplification, bool *reduced_away, double *accum_area, serial_feature *this_feature, serial_feature *tiny_feature);
int clip(double *x0, double *y0, double *x1, double *y1, double xmin, double ymin, double xmax, double ymax);
drawvec clip_lines(drawvec &geom, int z, long long buffer);
drawvec stairstep(drawvec &geom, int z, int detail);
+1
View File
@@ -2952,6 +2952,7 @@ int main(int argc, char **argv) {
{"simplify-only-low-zooms", no_argument, &prevent[P_SIMPLIFY_LOW], 1},
{"simplification-at-maximum-zoom", required_argument, 0, '~'},
{"no-tiny-polygon-reduction", no_argument, &prevent[P_TINY_POLYGON_REDUCTION], 1},
{"no-tiny-polygon-reduction-at-maximum-zoom", no_argument, &prevent[P_TINY_POLYGON_REDUCTION_AT_MAXZOOM], 1},
{"tiny-polygon-size", required_argument, 0, '~'},
{"no-simplification-of-shared-nodes", no_argument, &prevent[P_SIMPLIFY_SHARED_NODES], 1},
{"visvalingam", no_argument, &additional[A_VISVALINGAM], 1},
+7 -1
View File
@@ -27,7 +27,11 @@ see the shape and relative popularity of every point of interest and every
significant travel corridor.
.SH Installation
.PP
For this fork you will need to build from the source repository:
The easiest way to install tippecanoe on OSX is with Homebrew \[la]http://brew.sh/\[ra]:
.PP
$ brew install tippecanoe
.PP
On Ubuntu it will usually be easiest to build from the source repository:
.PP
.RS
.nf
@@ -629,6 +633,8 @@ the line or polygon within one tile unit of its proper location. You can probabl
.IP \(bu 2
\fB\fC\-pt\fR or \fB\fC\-\-no\-tiny\-polygon\-reduction\fR: Don't combine the area of very small polygons into small squares that represent their combined area.
.IP \(bu 2
\fB\fC\-pT\fR or \fB\fC\-\-no\-tiny\-polygon\-reduction\-at\-maximum\-zoom\fR: Combine the area of very small polygons into small squares that represent their combined area only at zoom levels below the maximum.
.IP \(bu 2
\fB\fC\-\-tiny\-polygon\-size=\fR\fIsize\fP: Use the specified \fIsize\fP for tiny polygons instead of the default 2. Anything above 6 or so will lead to visible artifacts with the default tile detail.
.IP \(bu 2
\fB\fC\-av\fR or \fB\fC\-\-visvalingam\fR: Use Visvalingam's simplification algorithm rather than Douglas\-Peucker's.
+1
View File
@@ -39,6 +39,7 @@
#define P_CLIPPING ((int) 'c')
#define P_DUPLICATION ((int) 'D')
#define P_TINY_POLYGON_REDUCTION ((int) 't')
#define P_TINY_POLYGON_REDUCTION_AT_MAXZOOM ((int) 'T')
#define P_TILE_COMPRESSION ((int) 'C')
#define P_TILE_STATS ((int) 'g')
#define P_USE_SOURCE_POLYGON_WINDING ((int) 'w')
-1
View File
@@ -8,7 +8,6 @@
"maxzoom": "9",
"minzoom": "8",
"name": "tests/allow-existing/both.mbtiles",
"strategies": "[{},{},{},{},{},{},{},{},{\"tiny_polygons\":1},{}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,6 +9,7 @@
"maxzoom": "1",
"minzoom": "0",
"name": "tests/border/out/-z1_--detect-shared-borders.json.check.mbtiles",
"strategies": "[{\"tiny_polygons\":1},{\"tiny_polygons\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,6 @@
"maxzoom": "1",
"minzoom": "0",
"name": "tests/coalesce-id/out/-z1_--coalesce_--reorder.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":2}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,6 @@
"maxzoom": "11",
"minzoom": "11",
"name": "tests/coalesce-tract/out/-P_--coalesce_--reorder_-z11_-Z11_-y_STATEFP10_-y_COUNTYFP10_-l_merged.json.check.mbtiles",
"strategies": "[{},{},{},{},{},{},{},{},{},{},{},{\"tiny_polygons\":5}]",
"type": "overlay",
"version": "2"
}, "features": [
-1
View File
@@ -9,7 +9,6 @@
"maxzoom": "2",
"minzoom": "0",
"name": "tests/curve/out/-z2.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":1},{\"tiny_polygons\":4}]",
"type": "overlay",
"version": "2"
}, "features": [
-1
View File
@@ -9,7 +9,6 @@
"maxzoom": "2",
"minzoom": "0",
"name": "tests/curve/out/-z2_--no-clipping.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":1},{\"tiny_polygons\":10}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,6 @@
"maxzoom": "2",
"minzoom": "0",
"name": "tests/curve/out/-z2_--no-duplication.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":6},{\"tiny_polygons\":6}]",
"type": "overlay",
"version": "2"
}, "features": [
-1
View File
@@ -9,7 +9,6 @@
"maxzoom": "5",
"minzoom": "0",
"name": "tests/dateline/out/-z5.json.check.mbtiles",
"strategies": "[{},{},{},{\"tiny_polygons\":1},{},{\"tiny_polygons\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
-1
View File
@@ -9,7 +9,6 @@
"maxzoom": "5",
"minzoom": "0",
"name": "tests/dateline/out/-z5_-b0.json.check.mbtiles",
"strategies": "[{},{},{},{\"tiny_polygons\":1},{},{}]",
"type": "overlay",
"version": "2"
}, "features": [
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -9,6 +9,7 @@
"maxzoom": "0",
"minzoom": "0",
"name": "tests/named/out/-z0_-Lalgeria%3atests%2fnamed%2falg_-Lalbania%3atests%2fnamed%2falb.json.check.mbtiles",
"strategies": "[{\"tiny_polygons\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,6 +9,7 @@
"maxzoom": "0",
"minzoom": "0",
"name": "tests/named/out/-z0_-Lalgeria%3atests%2fnamed%2falg_-Lalbania%3atests%2fnamed%2falb_-lunified.json.check.mbtiles",
"strategies": "[{\"tiny_polygons\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,6 @@
"maxzoom": "5",
"minzoom": "5",
"name": "tests/ne_110m_admin_0_countries/out/-R5%2f17%2f11.json.check.mbtiles",
"strategies": "[{},{},{},{},{},{\"tiny_polygons\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "5",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--drop-densest-as-needed.json.check.mbtiles",
"strategies": "[{\"dropped_as_needed\":171,\"tile_size_desired\":39209},{\"dropped_as_needed\":189,\"tiny_polygons\":1,\"tile_size_desired\":25164},{\"dropped_as_needed\":161,\"tiny_polygons\":2,\"tile_size_desired\":21198},{\"dropped_as_needed\":134,\"tiny_polygons\":12,\"tile_size_desired\":10761},{\"dropped_as_needed\":62,\"tiny_polygons\":20,\"tile_size_desired\":6604},{\"tiny_polygons\":47}]",
"strategies": "[{\"dropped_as_needed\":171,\"tile_size_desired\":39209},{\"dropped_as_needed\":189,\"tile_size_desired\":25164},{\"dropped_as_needed\":161,\"tile_size_desired\":21198},{\"dropped_as_needed\":134,\"tile_size_desired\":10761},{\"dropped_as_needed\":62,\"tile_size_desired\":6604},{\"tiny_polygons\":2}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "5",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--drop-fraction-as-needed.json.check.mbtiles",
"strategies": "[{\"dropped_as_needed\":160,\"tile_size_desired\":39209},{\"dropped_as_needed\":188,\"tile_size_desired\":25164},{\"dropped_as_needed\":190,\"tiny_polygons\":2,\"tile_size_desired\":21198},{\"dropped_as_needed\":180,\"tiny_polygons\":9,\"tile_size_desired\":10761},{\"dropped_as_needed\":145,\"tiny_polygons\":17,\"tile_size_desired\":6604},{\"tiny_polygons\":47}]",
"strategies": "[{\"dropped_as_needed\":160,\"tile_size_desired\":39209},{\"dropped_as_needed\":188,\"tile_size_desired\":25164},{\"dropped_as_needed\":190,\"tile_size_desired\":21198},{\"dropped_as_needed\":180,\"tile_size_desired\":10761},{\"dropped_as_needed\":145,\"tile_size_desired\":6604},{\"tiny_polygons\":2}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "5",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--drop-smallest-as-needed.json.check.mbtiles",
"strategies": "[{\"dropped_as_needed\":174,\"tile_size_desired\":39209},{\"dropped_as_needed\":202,\"tile_size_desired\":25164},{\"dropped_as_needed\":190,\"tiny_polygons\":2,\"tile_size_desired\":21198},{\"dropped_as_needed\":156,\"tiny_polygons\":12,\"tile_size_desired\":10761},{\"dropped_as_needed\":80,\"tiny_polygons\":20,\"tile_size_desired\":6604},{\"tiny_polygons\":47}]",
"strategies": "[{\"dropped_as_needed\":174,\"tile_size_desired\":39209},{\"dropped_as_needed\":202,\"tile_size_desired\":25164},{\"dropped_as_needed\":190,\"tile_size_desired\":21198},{\"dropped_as_needed\":156,\"tile_size_desired\":10761},{\"dropped_as_needed\":80,\"tile_size_desired\":6604},{\"tiny_polygons\":2}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "5",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--force-feature-limit.json.check.mbtiles",
"strategies": "[{\"dropped_as_needed\":316,\"tile_size_desired\":39209},{\"dropped_as_needed\":287,\"tiny_polygons\":4,\"tile_size_desired\":25164},{\"dropped_as_needed\":223,\"tiny_polygons\":4,\"tile_size_desired\":21198},{\"dropped_as_needed\":93,\"tiny_polygons\":14,\"tile_size_desired\":10761},{\"dropped_as_needed\":9,\"tiny_polygons\":21,\"tile_size_desired\":6604},{\"tiny_polygons\":47}]",
"strategies": "[{\"dropped_as_needed\":316,\"tile_size_desired\":39209},{\"dropped_as_needed\":287,\"tiny_polygons\":3,\"tile_size_desired\":25164},{\"dropped_as_needed\":223,\"tiny_polygons\":2,\"tile_size_desired\":21198},{\"dropped_as_needed\":93,\"tile_size_desired\":10761},{\"dropped_as_needed\":9,\"tile_size_desired\":6604},{\"tiny_polygons\":2}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "0",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z0_--tiny-polygon-size_100.json.check.mbtiles",
"strategies": "[{\"tiny_polygons\":138}]",
"strategies": "[{\"tiny_polygons\":150}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "0",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z0_--tiny-polygon-size_50_--order-largest-first.json.check.mbtiles",
"strategies": "[{\"tiny_polygons\":90}]",
"strategies": "[{\"tiny_polygons\":109}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "0",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z0_--tiny-polygon-size_50_--simplification_50.json.check.mbtiles",
"strategies": "[{\"tiny_polygons\":90}]",
"strategies": "[{\"tiny_polygons\":109}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "2",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z2_--convert-polygons-to-label-points.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":2},{\"tiny_polygons\":3}]",
"strategies": "[{},{},{\"tiny_polygons\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "3",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z3_-ai.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":2},{\"tiny_polygons\":3},{\"tiny_polygons\":12}]",
"strategies": "[{},{},{\"tiny_polygons\":1},{}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "4",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z4_-yname.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":2},{\"tiny_polygons\":3},{\"tiny_polygons\":12},{\"tiny_polygons\":20}]",
"strategies": "[{},{\"tiny_polygons\":1},{\"tiny_polygons\":1},{},{}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "4",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z4_-yname_--drop-polygons.json.check.mbtiles",
"strategies": "[{\"dropped_by_rate\":172},{\"dropped_by_rate\":205,\"tiny_polygons\":1},{\"dropped_by_rate\":189},{\"dropped_by_rate\":166,\"tiny_polygons\":7},{\"tiny_polygons\":20}]",
"strategies": "[{\"dropped_by_rate\":172},{\"dropped_by_rate\":205},{\"dropped_by_rate\":189},{\"dropped_by_rate\":166},{}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "4",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z4_-yname_-S4.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":2},{\"tiny_polygons\":3},{\"tiny_polygons\":12},{\"tiny_polygons\":20}]",
"strategies": "[{},{\"tiny_polygons\":1},{\"tiny_polygons\":1},{},{}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "4",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z4_-yname_-S4_--simplification-at-maximum-zoom_2.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":2},{\"tiny_polygons\":3},{\"tiny_polygons\":12},{\"tiny_polygons\":20}]",
"strategies": "[{},{\"tiny_polygons\":1},{\"tiny_polygons\":1},{},{}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "4",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z4_-yname_-S4_--visvalingam.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":2},{\"tiny_polygons\":3},{\"tiny_polygons\":12},{\"tiny_polygons\":20}]",
"strategies": "[{},{\"tiny_polygons\":1},{\"tiny_polygons\":1},{},{}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,6 @@
"maxzoom": "4",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z4_-yname_-pD.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":45},{\"tiny_polygons\":29},{\"tiny_polygons\":70},{\"tiny_polygons\":120}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,6 @@
"maxzoom": "4",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z4_-yname_-pc.json.check.mbtiles",
"strategies": "[{},{\"tiny_polygons\":1},{\"tiny_polygons\":8},{\"tiny_polygons\":32},{\"tiny_polygons\":63}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "5",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z5_-M5000_--coalesce-densest-as-needed.json.check.mbtiles",
"strategies": "[{\"coalesced_as_needed\":528,\"detail_reduced\":2,\"tile_size_desired\":39204},{\"coalesced_as_needed\":212,\"tile_size_desired\":25156},{\"coalesced_as_needed\":192,\"tiny_polygons\":3,\"tile_size_desired\":21207},{\"coalesced_as_needed\":156,\"tiny_polygons\":11,\"tile_size_desired\":10753},{\"coalesced_as_needed\":65,\"tiny_polygons\":20,\"tile_size_desired\":6588},{\"tiny_polygons\":46}]",
"strategies": "[{\"coalesced_as_needed\":528,\"detail_reduced\":2,\"tiny_polygons\":2,\"tile_size_desired\":39204},{\"coalesced_as_needed\":212,\"tile_size_desired\":25156},{\"coalesced_as_needed\":192,\"tiny_polygons\":1,\"tile_size_desired\":21207},{\"coalesced_as_needed\":156,\"tile_size_desired\":10753},{\"coalesced_as_needed\":65,\"tile_size_desired\":6588},{\"tiny_polygons\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "5",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z5_-M5000_--coalesce-fraction-as-needed.json.check.mbtiles",
"strategies": "[{\"coalesced_as_needed\":528,\"detail_reduced\":2,\"tile_size_desired\":39204},{\"coalesced_as_needed\":217,\"tile_size_desired\":25156},{\"coalesced_as_needed\":218,\"tiny_polygons\":2,\"tile_size_desired\":21207},{\"coalesced_as_needed\":227,\"tiny_polygons\":4,\"tile_size_desired\":10753},{\"coalesced_as_needed\":192,\"tiny_polygons\":13,\"tile_size_desired\":6588},{\"tiny_polygons\":46}]",
"strategies": "[{\"coalesced_as_needed\":528,\"detail_reduced\":2,\"tiny_polygons\":2,\"tile_size_desired\":39204},{\"coalesced_as_needed\":217,\"tile_size_desired\":25156},{\"coalesced_as_needed\":218,\"tile_size_desired\":21207},{\"coalesced_as_needed\":227,\"tile_size_desired\":10753},{\"coalesced_as_needed\":192,\"tile_size_desired\":6588},{\"tiny_polygons\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "5",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z5_-M5000_--coalesce-smallest-as-needed.json.check.mbtiles",
"strategies": "[{\"coalesced_as_needed\":1272,\"tile_size_desired\":39204},{\"coalesced_as_needed\":1191,\"tiny_polygons\":1,\"tile_size_desired\":25156},{\"coalesced_as_needed\":731,\"tiny_polygons\":3,\"tile_size_desired\":21207},{\"coalesced_as_needed\":178,\"tiny_polygons\":8,\"tile_size_desired\":10753},{\"coalesced_as_needed\":74,\"tiny_polygons\":20,\"tile_size_desired\":6588},{\"tiny_polygons\":46}]",
"strategies": "[{\"coalesced_as_needed\":1272,\"tiny_polygons\":5,\"tile_size_desired\":39204},{\"coalesced_as_needed\":1191,\"tile_size_desired\":25156},{\"coalesced_as_needed\":731,\"tiny_polygons\":1,\"tile_size_desired\":21207},{\"coalesced_as_needed\":178,\"tile_size_desired\":10753},{\"coalesced_as_needed\":74,\"tile_size_desired\":6588},{\"tiny_polygons\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "5",
"minzoom": "0",
"name": "tests/ne_110m_admin_0_countries/out/-z5_-M5000_--drop-smallest-as-needed.json.check.mbtiles",
"strategies": "[{\"dropped_as_needed\":174,\"tile_size_desired\":39204},{\"dropped_as_needed\":202,\"tile_size_desired\":25156},{\"dropped_as_needed\":190,\"tiny_polygons\":2,\"tile_size_desired\":21207},{\"dropped_as_needed\":156,\"tiny_polygons\":12,\"tile_size_desired\":10753},{\"dropped_as_needed\":78,\"tiny_polygons\":20,\"tile_size_desired\":6588},{\"tiny_polygons\":46}]",
"strategies": "[{\"dropped_as_needed\":174,\"tile_size_desired\":39204},{\"dropped_as_needed\":202,\"tile_size_desired\":25156},{\"dropped_as_needed\":190,\"tile_size_desired\":21207},{\"dropped_as_needed\":156,\"tile_size_desired\":10753},{\"dropped_as_needed\":78,\"tile_size_desired\":6588},{\"tiny_polygons\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
+1 -1
View File
@@ -9,7 +9,7 @@
"maxzoom": "4",
"minzoom": "0",
"name": "tests/ne_110m_ocean/join/ocean.mbtiles + tests/ne_110m_ocean/join/countries.mbtiles",
"strategies": "[{},{\"tiny_polygons\":2},{\"tiny_polygons\":3},{\"tiny_polygons\":12},{\"tiny_polygons\":23}]",
"strategies": "[{},{},{},{},{\"tiny_polygons\":4}]",
"type": "overlay",
"version": "2"
}, "features": [
+1 -1
View File
@@ -9,7 +9,7 @@
"maxzoom": "4",
"minzoom": "0",
"name": "tests/nullisland/out/-b0_-z4.json.check.mbtiles",
"strategies": "[{\"dropped_by_rate\":4},{\"dropped_by_rate\":8,\"tiny_polygons\":12},{\"dropped_by_rate\":8},{\"dropped_by_rate\":3},{}]",
"strategies": "[{\"dropped_by_rate\":4},{\"dropped_by_rate\":8},{\"dropped_by_rate\":8},{\"dropped_by_rate\":3},{}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -10,7 +10,7 @@
"maxzoom": "4",
"minzoom": "0",
"name": "tests/nullisland/out/-b0_-z4_-ANullIsland.json.check.mbtiles",
"strategies": "[{\"dropped_by_rate\":4},{\"dropped_by_rate\":8,\"tiny_polygons\":12},{\"dropped_by_rate\":8},{\"dropped_by_rate\":3},{}]",
"strategies": "[{\"dropped_by_rate\":4},{\"dropped_by_rate\":8},{\"dropped_by_rate\":8},{\"dropped_by_rate\":3},{}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,7 +9,7 @@
"maxzoom": "4",
"minzoom": "0",
"name": "tests/nullisland/out/-b0_-z4_-NNullIsland.json.check.mbtiles",
"strategies": "[{\"dropped_by_rate\":4},{\"dropped_by_rate\":8,\"tiny_polygons\":12},{\"dropped_by_rate\":8},{\"dropped_by_rate\":3},{}]",
"strategies": "[{\"dropped_by_rate\":4},{\"dropped_by_rate\":8},{\"dropped_by_rate\":8},{\"dropped_by_rate\":3},{}]",
"type": "overlay",
"version": "2"
}, "features": [
@@ -9,6 +9,7 @@
"maxzoom": "0",
"minzoom": "0",
"name": "tests/polygon-winding/out/-z0_--reverse-source-polygon-winding.json.check.mbtiles",
"strategies": "[{\"tiny_polygons\":1}]",
"type": "overlay",
"version": "2"
}, "features": [
+7
View File
@@ -544,6 +544,13 @@ struct reader {
overzoom_consumed_at_this_zoom = false;
}
if (overzoomed_tiles.size() == 0) {
// we have nothing to overzoom; give up
current_tile_is_overzoomed = false;
zoom = 32;
return;
}
auto xy = overzoomed_tiles.front();
overzoomed_tiles.erase(overzoomed_tiles.begin());
+16 -7
View File
@@ -2138,14 +2138,14 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
add_sample_to(extents, sf.extent, extents_increment, seq);
// search here is for LLONG_MAX, not minextent, because we are dropping features, not coalescing them,
// so we shouldn't expect to find anything small that we can related this feature to.
if (sf.extent + coalesced_area <= minextent && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
if (minextent != 0 && sf.extent + coalesced_area <= minextent && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
preserve_attributes(arg->attribute_accum, sf, stringpool, pool_off, partials[which_partial]);
strategy->dropped_as_needed++;
continue;
}
} else if (additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
add_sample_to(extents, sf.extent, extents_increment, seq);
if (sf.extent + coalesced_area <= minextent && find_partial(partials, sf, which_partial, layer_unmaps, minextent)) {
if (minextent != 0 && sf.extent + coalesced_area <= minextent && find_partial(partials, sf, which_partial, layer_unmaps, minextent)) {
partials[which_partial].geoms.push_back(sf.geometry);
partials[which_partial].coalesced = true;
coalesced_area += sf.extent;
@@ -2182,18 +2182,27 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
}
fraction_accum -= 1;
bool reduced = false;
bool still_need_simplification_after_reduction = false;
if (sf.t == VT_POLYGON) {
if (!prevent[P_TINY_POLYGON_REDUCTION] && !additional[A_GRID_LOW_ZOOMS]) {
sf.geometry = reduce_tiny_poly(sf.geometry, z, line_detail, &reduced, &accum_area, &sf, &tiny_feature);
if (reduced) {
bool simplified_away_by_reduction = false;
bool prevent_tiny = prevent[P_TINY_POLYGON_REDUCTION] ||
(prevent[P_TINY_POLYGON_REDUCTION_AT_MAXZOOM] && z == maxzoom);
if (!prevent_tiny && !additional[A_GRID_LOW_ZOOMS]) {
sf.geometry = reduce_tiny_poly(sf.geometry, z, line_detail, &still_need_simplification_after_reduction, &simplified_away_by_reduction, &accum_area, &sf, &tiny_feature);
if (simplified_away_by_reduction) {
strategy->tiny_polygons++;
}
if (sf.geometry.size() == 0) {
continue;
}
} else {
still_need_simplification_after_reduction = true; // reduction skipped, so always simplify
}
} else {
still_need_simplification_after_reduction = true; // not a polygon, so simplify
}
if (sf.t == VT_POLYGON || sf.t == VT_LINE) {
if (line_is_too_small(sf.geometry, z, line_detail)) {
continue;
@@ -2220,7 +2229,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
p.t = sf.t;
p.segment = sf.segment;
p.original_seq = sf.seq;
p.reduced = reduced;
p.reduced = !still_need_simplification_after_reduction;
p.coalesced = false;
p.z = z;
p.tx = tx;
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "v2.30.0"
#define VERSION "v2.31.0"
#endif