Select to view content in your preferred language

Obtaining the intersecting point from a self-intersecting polyline.

711
2
Jump to solution
02-21-2022 11:42 PM
SalvadorApltp
New Contributor III

I am able to use GeometryEngine.intersections() in order to obtain a Multipoint object with the intersection points of two poyllines. But if I try with a self-intersecting polyline, I get returned a Polyline object, and I am unsure how to obtain the intersection of such an item.

I don't quite understand the documentation (GeometryEngine (ArcGIS Runtime SDK for Android 100.13.0)) when it speaks about this issue, regretfully, so I was hoping for some answers.

Is there a way to obtain the intersection of a Polyline object? Is obtaining the intersection point of a self-intersecting polyline even possible?

Thank you.

0 Kudos
1 Solution

Accepted Solutions
JonL
by Esri Contributor
Esri Contributor

Hello and thanks for reaching out,

As you've pointed out, the `GeometryEngine.intersections()`  method requires two geometries.

As a result, there is currently no API for obtaining the self-intersection of a single polyline.

It would be possible, howerver, to implement this manually by making a new polyline out of each segment of your original polyline. It would then be possible to iterate over these segments, using ` GeometryEngine.intersections(selfIntersectingPolyline, segment)` to find the intersection points between them and your original geometry.

There may be a few caveats to keep in mind here, for example, if the self-intersecting geometry is very complex (i.e. consists of many segments), then this could result in a quite a few calls to ` GeometryEngine.intersections()`, and might take a fair while to compute.

View solution in original post

2 Replies
JonL
by Esri Contributor
Esri Contributor

Hello and thanks for reaching out,

As you've pointed out, the `GeometryEngine.intersections()`  method requires two geometries.

As a result, there is currently no API for obtaining the self-intersection of a single polyline.

It would be possible, howerver, to implement this manually by making a new polyline out of each segment of your original polyline. It would then be possible to iterate over these segments, using ` GeometryEngine.intersections(selfIntersectingPolyline, segment)` to find the intersection points between them and your original geometry.

There may be a few caveats to keep in mind here, for example, if the self-intersecting geometry is very complex (i.e. consists of many segments), then this could result in a quite a few calls to ` GeometryEngine.intersections()`, and might take a fair while to compute.

SalvadorApltp
New Contributor III

Thank you very much by your reply, JonL

I didn't think of creating a polyline per segment, that could work. I was hoping I wouldn't have to do any workarounds, but it can't be helped, I'll see what I can do. Thank you for the warning about the possible performance impact, as well. 

I'd love a "selfIntersections" method or somesuch, it would be appreciated for future versions.

Meanwhile, however, I will test out this method you've pointed out and then get back to you if I am successful, and if I am, I will mark it as the solution.

Thank you kindly for your greatly helpful answer!

0 Kudos