AnsweredAssumed Answered

How to find the point where two polylines intersect??

Question asked by peterlen on Jan 12, 2017
Latest reply on Jan 12, 2017 by rscheitlin

Hello,

In my client, I have two polylines.  I need to find the point where both lines intersect.  I thought that I had found a way to find that out by using the esri.geometry.getLineIntersection(pt, pt, pt, pt), which takes the starting and ending points of each lines.  That does in fact return a single point at the intersection, but the problem is that the function calculates all of the intersections as if both lines would continue forever.  Since one of the polylines will have multiple line segments going in various directions, the getLineIntersection returns multiple points, even though both lines only crossed once.  The function does not take into consideration the length of the line in order to determine if an intersection takes place.

 

Does anyone know there another way to do this so that I only get the one single intersection point?

 

 

My specs: The solution needs to be client-based (JavaScript API) using the Esri JavaScript v3.9 API (I know it is an older API but I cannot upgrade).

 

If it can't be done with my specs, then that is fine.  At least I would know.

 

Thanks for any thoughts - Peter

Outcomes