Generating a valid loop after splitting up a polygon at the antimeridian #529
boulder-pika
started this conversation in
General
Replies: 1 comment
-
|
I think you need to use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Greetings -
I am very much new to this library, but would like to use it to break up polygons that span the antimeridian. To that effect, I've reviewed a related post at #439.
But I have a question about how to turn the outputted edges into valid geometry. Start with the test code at
s2geometry/src/s2/s2boolean_operation_test.cc
Line 1757 in b99a794
One can see the resulting path is: 90:0, 0:180, 0:-120, 0:0, 0:120, 0:180. But if I wanted to create an S2Loop with this path, it would be invalid per the comment at
s2geometry/src/s2/s2loop.h
Line 72 in b99a794
The above path visits 0:180 twice.
And per the comment at https://github.com/google/s2geometry/blob/b99a7941052c1347ed84a508669d3155c2963b20/src/s2/s2loop.h#L65C1-L67C9:
I understand that there is an implicit 90:0 at the end of the path to close the loop. Hence, the 0:180 should not be interpreted as a closing vertex which may justify its appearance twice.
The S2 library appears to be outputting an invalid path when splitting a polygon, preventing me from using it in external geojson applications. Can somebody help me overcome this conceptual problem? Is there a way to generate a valid loop from this path? Any code / examples to point me at would be beneficial. As stated, I'm very new to this library and am wagering there is some piece I am missing.
Beta Was this translation helpful? Give feedback.
All reactions