Replies: 8 comments 15 replies
-
You need to use a
|
Beta Was this translation helpful? Give feedback.
-
Ok I took a polygon in the eastern hemisphere and cut it along the 60E line and it seems to work as designed. The squares are the original vertices and the red dots are the results of the Split function. Any other things I could try for those that cross the dateline? |
Beta Was this translation helpful? Give feedback.
-
Ok I added some more tweaks and it works great now. The main issue was the coordinates along the dateline. You have to make sure that once you unshift the coordinates then use the appropriate dateline values. if your polygon sits in the eastern hemisphere then it should be +180, else if polygon is on the western hemisphere then it should be -180. |
Beta Was this translation helpful? Give feedback.
-
Apologies, I wasn't checking my email. But yes , let me clean it up a bit and post the code. It uses DotSpatial as its main framework but many of the functions come from NTS. |
Beta Was this translation helpful? Give feedback.
-
I almost forgot about this. Let me get the code and post it here. |
Beta Was this translation helpful? Give feedback.
-
Ok here is my code. it is written in VB but could be translated to C# fairly easily. I use DotSpatial so there may be some DS specific functions. I think it can be converted to a pure NTS routine fairly easily as well. If there are any missing routines please let me know. The routine was tested on airspace polygons so it may not work for all scenarios. It is based on geographic coordinates (specifically WGS84) so projected coordinates may need to be translated first before using the routine. Please give me any feedback on enhancing the routine. The routine returns a collection of polygon geometries. What you do with that collection is up to you. You can either create a multi-part feature or split the geometries up into individual features. Calling the routine
The logic meat
|
Beta Was this translation helpful? Give feedback.
-
It would be great if this was added to the product - it will solve an issue I have right now …. Please update this ticket once it’s added and I willl update and give it a try.
… On 30/11/2021, at 4:38 AM, Felix Obermaier ***@***.***> wrote:
@sindizzy thank you very much I'll look at the code asap
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Beta Was this translation helpful? Give feedback.
-
I have a beta in my fork. Please take a look, test, critique, suggest, |
Beta Was this translation helpful? Give feedback.
-
So I have an ellipse (a polygon geometry) that spans the Dateline. If I build the polygon with the coordinates as-is (namely the longitudes are in the range -180 to +180) it then results with the geometry being Invalid and thus when I intersect the polygon with the points I get the error:
found non-noded intersection between LINESTRING(-155.32030939830221 83.16240616001781, -153.83095758124398 83.120852884772134) and LINESTRING(178.6792290990447 83.116588616289192, -179.84787091746912 83.158205372008268) [ (-155.06664425130143, 83.155328841178274, NaN, NaN) ]
To alleviate this I take the polygon x values in the range -180 to +180 and shift them to the range 0 to 360. This gives me a valid geometry and the Intersection produces no exceptions. However the intersection only gives me points in the eastern hemisphere and the points in the western hemisphere are ignored.
Is this expected behavior? Is there anything I can do to process this data properly? Is the only solution to shift the points as well? I'm stumped as to how to proceed.
Beta Was this translation helpful? Give feedback.
All reactions