Better handling of features that cross the antimeridian

This commit is contained in:
Eric Fischer
2015-12-03 13:12:34 -08:00
parent 53471521f3
commit c832b34160
4 changed files with 25 additions and 25 deletions
+20
View File
@@ -544,6 +544,26 @@ long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsi
continue;
}
if (z == 0) {
if (bbox[0] < 0 || bbox[2] > 1LL << 32) {
// If the geometry extends off the edge of the world, concatenate on another copy
// shifted by 360 degrees, and then make sure both copies get clipped down to size.
unsigned n = geom.size();
for (unsigned i = 0; i < n; i++) {
geom.push_back(draw(geom[i].op, geom[i].x - (1LL << 32), geom[i].y));
}
for (unsigned i = 0; i < n; i++) {
geom.push_back(draw(geom[i].op, geom[i].x + (1LL << 32), geom[i].y));
}
bbox[0] = 0;
bbox[2] = 1LL << 32;
quick = -1;
}
}
if (quick != 1) {
if (t == VT_LINE) {
geom = clip_lines(geom, z, line_detail, buffer);