mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-22 04:18:01 +00:00
Don't closepath twice in multipolygons
This commit is contained in:
parent
dc3c6138d1
commit
43b27e2dfd
@ -169,6 +169,7 @@ void parse_geometry(int t, json_object *j, unsigned *bbox, long long *fpos, FILE
|
||||
}
|
||||
|
||||
int within = geometry_within[t];
|
||||
long long began = *fpos;
|
||||
if (within >= 0) {
|
||||
int i;
|
||||
for (i = 0; i < j->length; i++) {
|
||||
@ -212,8 +213,10 @@ void parse_geometry(int t, json_object *j, unsigned *bbox, long long *fpos, FILE
|
||||
}
|
||||
}
|
||||
|
||||
if (mb_geometry[t] == VT_POLYGON) {
|
||||
serialize_int(out, VT_CLOSEPATH, fpos, fname, source);
|
||||
if (t == GEOM_POLYGON) {
|
||||
if (*fpos != began) {
|
||||
serialize_int(out, VT_CLOSEPATH, fpos, fname, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
5
tile.cc
5
tile.cc
@ -522,6 +522,10 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
||||
}
|
||||
}
|
||||
|
||||
if (j + 1 < geom.size() && geom[j + 1].op == VT_CLOSEPATH) {
|
||||
fprintf(stderr, "double closepath\n");
|
||||
}
|
||||
|
||||
double area = 0;
|
||||
for (unsigned k = i; k < j; k++) {
|
||||
area += geom[k].x * geom[i + ((k - i + 1) % (j - i))].y;
|
||||
@ -556,6 +560,7 @@ drawvec reduce_tiny_poly(drawvec &geom, int z, int detail, bool *reduced, double
|
||||
|
||||
i = j;
|
||||
} else {
|
||||
fprintf(stderr, "how did we get here with %d?\n", geom[i].op);
|
||||
out.push_back(geom[i]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user