mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Fix gridding of small squares; use less memory for small features
This commit is contained in:
+12
-2
@@ -318,6 +318,7 @@ static long long scale_geometry(struct serialization_state *sst, long long *bbox
|
||||
long long offset = 0;
|
||||
long long prev = 0;
|
||||
bool has_prev = false;
|
||||
double scale = 1.0 / (1 << geometry_scale);
|
||||
|
||||
for (size_t i = 0; i < geom.size(); i++) {
|
||||
if (geom[i].op == VT_MOVETO || geom[i].op == VT_LINETO) {
|
||||
@@ -365,8 +366,17 @@ static long long scale_geometry(struct serialization_state *sst, long long *bbox
|
||||
*(sst->initialized) = 1;
|
||||
}
|
||||
|
||||
geom[i].x = x >> geometry_scale;
|
||||
geom[i].y = y >> geometry_scale;
|
||||
if (additional[A_GRID_LOW_ZOOMS]) {
|
||||
// If we are gridding, snap to the maxzoom grid in case the incoming data
|
||||
// is already supposed to be aligned to tile boundaries (but is not, exactly,
|
||||
// because of rounding error during projection).
|
||||
|
||||
geom[i].x = std::round(x * scale);
|
||||
geom[i].y = std::round(y * scale);
|
||||
} else {
|
||||
geom[i].x = x >> geometry_scale;
|
||||
geom[i].y = y >> geometry_scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user