mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Reset counter with each tile, to match old low-zoom feature density
This commit is contained in:
@@ -217,15 +217,38 @@ struct drop_state {
|
|||||||
double scale;
|
double scale;
|
||||||
double seq;
|
double seq;
|
||||||
long long included;
|
long long included;
|
||||||
|
unsigned x;
|
||||||
|
unsigned y;
|
||||||
};
|
};
|
||||||
|
|
||||||
int calc_feature_minzoom(struct index *ix, struct drop_state *ds, int maxzoom, int basezoom, double droprate, double gamma) {
|
int calc_feature_minzoom(struct index *ix, struct drop_state *ds, int maxzoom, int basezoom, double droprate, double gamma) {
|
||||||
int feature_minzoom = 0;
|
int feature_minzoom = 0;
|
||||||
|
unsigned xx, yy;
|
||||||
|
decode(ix->index, &xx, &yy);
|
||||||
|
|
||||||
if (gamma >= 0 && (ix->t == VT_POINT ||
|
if (gamma >= 0 && (ix->t == VT_POINT ||
|
||||||
(additional[A_LINE_DROP] && ix->t == VT_LINE) ||
|
(additional[A_LINE_DROP] && ix->t == VT_LINE) ||
|
||||||
(additional[A_POLYGON_DROP] && ix->t == VT_POLYGON))) {
|
(additional[A_POLYGON_DROP] && ix->t == VT_POLYGON))) {
|
||||||
for (ssize_t i = maxzoom; i >= 0; i--) {
|
for (ssize_t i = maxzoom; i >= 0; i--) {
|
||||||
|
// XXX This resets the feature counter at the start of each tile,
|
||||||
|
// which makes the feature count come out close to what it is if
|
||||||
|
// feature dropping happens during tiling. It means that the low
|
||||||
|
// zooms are heavier than they legitimately should be though.
|
||||||
|
{
|
||||||
|
unsigned xxx = 0, yyy = 0;
|
||||||
|
if (i != 0) {
|
||||||
|
xxx = xx >> (32 - i);
|
||||||
|
yyy = yy >> (32 - i);
|
||||||
|
}
|
||||||
|
if (ds[i].x != xxx || ds[i].y != yyy) {
|
||||||
|
ds[i].seq = 0;
|
||||||
|
ds[i].gap = 0;
|
||||||
|
ds[i].previndex = 0;
|
||||||
|
}
|
||||||
|
ds[i].x = xxx;
|
||||||
|
ds[i].y = yyy;
|
||||||
|
}
|
||||||
|
|
||||||
ds[i].seq++;
|
ds[i].seq++;
|
||||||
}
|
}
|
||||||
for (ssize_t i = maxzoom; i >= 0; i--) {
|
for (ssize_t i = maxzoom; i >= 0; i--) {
|
||||||
@@ -836,6 +859,8 @@ void prep_drop_states(struct drop_state *ds, int maxzoom, int basezoom, double d
|
|||||||
ds[i].scale = (double) (1LL << (64 - 2 * (i + 8)));
|
ds[i].scale = (double) (1LL << (64 - 2 * (i + 8)));
|
||||||
ds[i].seq = 0;
|
ds[i].seq = 0;
|
||||||
ds[i].included = 0;
|
ds[i].included = 0;
|
||||||
|
ds[i].x = 0;
|
||||||
|
ds[i].y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -596,7 +596,6 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
|||||||
double accum_area = 0;
|
double accum_area = 0;
|
||||||
|
|
||||||
double interval = 0;
|
double interval = 0;
|
||||||
double seq = 0;
|
|
||||||
if (z < basezoom) {
|
if (z < basezoom) {
|
||||||
interval = std::exp(std::log(droprate) * (basezoom - z));
|
interval = std::exp(std::log(droprate) * (basezoom - z));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user