Add an option to do line simplification only at zooms below maxzoom

This commit is contained in:
Eric Fischer 2016-01-08 11:31:10 -08:00
parent 5e02bdd90a
commit 93d0767829
3 changed files with 7 additions and 1 deletions

View File

@ -106,6 +106,7 @@ Options
### Doing less
* -ps: Don't simplify lines
* -pS: Don't simplify lines at maxzoom (but do simplify at lower zooms)
* -pf: Don't limit tiles to 200,000 features
* -pk: Don't limit tiles to 500K bytes
* -pd: Dynamically drop some fraction of features from large tiles to keep them under the 500K size limit. It will probably look ugly at the tile boundaries.

View File

@ -130,6 +130,8 @@ If you use \-rg, it will guess a drop rate that will keep at most 50,000 feature
.IP \(bu 2
\-ps: Don't simplify lines
.IP \(bu 2
\-pS: Don't simplify lines at maxzoom (but do simplify at lower zooms)
.IP \(bu 2
\-pf: Don't limit tiles to 200,000 features
.IP \(bu 2
\-pk: Don't limit tiles to 500K bytes

View File

@ -479,6 +479,7 @@ struct partial {
int line_detail;
char *prevent;
char *additional;
int maxzoom;
};
struct partial_arg {
@ -499,8 +500,9 @@ void *partial_feature_worker(void *v) {
int line_detail = (*partials)[i].line_detail;
char *prevent = (*partials)[i].prevent;
char *additional = (*partials)[i].additional;
int maxzoom = (*partials)[i].maxzoom;
if ((t == VT_LINE || t == VT_POLYGON) && !prevent['s' & 0xFF]) {
if ((t == VT_LINE || t == VT_POLYGON) && !(prevent['s' & 0xFF] || (z == maxzoom && prevent['S' & 0xFF]))) {
if (1 /* !reduced */) { // XXX why did this not simplify if reduced?
if (t == VT_LINE) {
geom = remove_noop(geom, t, 32 - z - line_detail);
@ -806,6 +808,7 @@ long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsi
p.line_detail = line_detail;
p.prevent = prevent;
p.additional = additional;
p.maxzoom = maxzoom;
partials.push_back(p);
}
}