Add an option to prevent tiny polygon reduction

This commit is contained in:
Eric Fischer 2016-11-21 11:26:37 -08:00
parent dc9e68b128
commit e9aa8c1b7d
6 changed files with 4040 additions and 3 deletions

View File

@ -144,6 +144,7 @@ resolution is obtained than by using a smaller _maxzoom_ or _detail_.
* -pp or --no-polygon-splitting: Don't split complex polygons (over 700 vertices after simplification) into multiple features.
* -pc or --no-clipping: Don't clip features to the size of the tile. If a feature overlaps the tile's bounds or buffer at all, it is included completely. Be careful: this can produce very large tilesets, especially with large polygons.
* -pD or --no-duplication: As with --no-clipping, each feature is included intact instead of cut to tile boundaries. In addition, it is included only in a single tile per zoom level rather than potentially in multiple copies. Clients of the tileset must check adjacent tiles (possibly some distance away) to ensure they have all features.
* -pt or --no-tiny-polygon-reduction: Don't combine the area of very small polygons into small squares that represent their combined area.
* -q or --quiet: Work quietly instead of reporting progress
Example
@ -242,7 +243,8 @@ For line features, it drops any features that are too small to draw at all.
This still leaves the lower zooms too dark (and too dense for the 500K tile limit,
in some places), so I need to figure out an equitable way to throw features away.
Any polygons that are smaller than a minimum area (currently 4 square subpixels) will
Unless you specify `--no-tiny-polygon-reduction`,
any polygons that are smaller than a minimum area (currently 4 square subpixels) will
have their probability diffused, so that some of them will be drawn as a square of
this minimum size and others will not be drawn at all, preserving the total area that
all of them should have had together.

View File

@ -1931,6 +1931,7 @@ int main(int argc, char **argv) {
{"no-polygon-splitting", no_argument, &prevent[P_POLYGON_SPLIT], 1},
{"no-clipping", no_argument, &prevent[P_CLIPPING], 1},
{"no-duplication", no_argument, &prevent[P_DUPLICATION], 1},
{"no-tiny-polygon-reduction", no_argument, &prevent[P_TINY_POLYGON_REDUCTION], 1},
{0, 0, 0, 0},
};

View File

@ -184,6 +184,8 @@ which may not be what you want.
.IP \(bu 2
\-pD or \-\-no\-duplication: As with \-\-no\-clipping, each feature is included intact instead of cut to tile boundaries. In addition, it is included only in a single tile per zoom level rather than potentially in multiple copies. Clients of the tileset must check adjacent tiles (possibly some distance away) to ensure they have all features.
.IP \(bu 2
\-pt or \-\-no\-tiny\-polygon\-reduction: Don't combine the area of very small polygons into small squares that represent their combined area.
.IP \(bu 2
\-q or \-\-quiet: Work quietly instead of reporting progress
.RE
.SH Example
@ -287,7 +289,8 @@ For line features, it drops any features that are too small to draw at all.
This still leaves the lower zooms too dark (and too dense for the 500K tile limit,
in some places), so I need to figure out an equitable way to throw features away.
.PP
Any polygons that are smaller than a minimum area (currently 4 square subpixels) will
Unless you specify \fB\fC\-\-no\-tiny\-polygon\-reduction\fR,
any polygons that are smaller than a minimum area (currently 4 square subpixels) will
have their probability diffused, so that some of them will be drawn as a square of
this minimum size and others will not be drawn at all, preserving the total area that
all of them should have had together.

View File

@ -22,6 +22,7 @@
#define P_POLYGON_SPLIT ((int) 'p')
#define P_CLIPPING ((int) 'c')
#define P_DUPLICATION ((int) 'D')
#define P_TINY_POLYGON_REDUCTION ((int) 't')
extern int prevent[256];
extern int additional[256];

File diff suppressed because one or more lines are too long

View File

@ -1513,7 +1513,9 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
bool reduced = false;
if (t == VT_POLYGON) {
if (!prevent[P_TINY_POLYGON_REDUCTION]) {
geom = reduce_tiny_poly(geom, z, line_detail, &reduced, &accum_area);
}
has_polygons = true;
}