You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the stitching of a single polygon where a single edge (DE…GH) lies on the antimeridian:
C-----D
| |
| E
| /
| F
| \
| G
| |
I-----H
During stitching, two fragments are considered:
C-----D
|
| E
| /
| F
| \
| G
|
I-----H
After stitching, this produces two rings:
C-----D
| |
| |
| |
| |
| |
| |
| |
I-----H
E
/|
F |
\|
G
This is because the points that lie on the antimeridian (D, E, G and H) do not have a matching fragment on the other side of the antimeridian to join to. So the fragments DCIH and EFG are each treated as “standalone rings”, resulting in separate polygons.
varshared={};// Record the y-intersections with the antimeridian.p.coordinates.forEach(function(ring){ring.forEach(function(p){if(p[0]===-180||p[0]===180){shared[p[1]]|=p[0]===-180 ? 1 : 2;}});});// Offset any unshared antimeridian points to prevent their stitching.p.coordinates.forEach(function(ring){ring.forEach(function(p){if((p[0]===-180||p[0]===180)&&shared[p[1]]!==3){p[0]=p[0]===-180 ? -179.9995 : 179.9995;}});});
But it seems to me that d3.geoStitch could do this by default, and then simple cases like this wouldn’t get broken by d3.geoStitch:
Consider the stitching of a single polygon where a single edge (DE…GH) lies on the antimeridian:
During stitching, two fragments are considered:
After stitching, this produces two rings:
This is because the points that lie on the antimeridian (D, E, G and H) do not have a matching fragment on the other side of the antimeridian to join to. So the fragments DCIH and EFG are each treated as “standalone rings”, resulting in separate polygons.
I employed this workaround to stitch contours:
But it seems to me that d3.geoStitch could do this by default, and then simple cases like this wouldn’t get broken by d3.geoStitch:
The text was updated successfully, but these errors were encountered: