Let's consider these 2 feature classes below, both of them are simple single-part lines. I need to find a reliable way to get the first and last intersection points between them (the green and yellow ones). enter image description here I tried applying the Intersect tool to obtain all the points where the features overlap. I got the following result: enter image description here The problem is that the tool gave me a multipoint feature class, with one feature for each line segment of the yellow feature class that was intersected. Here is a screenshot of the table of contents: enter image description here I tried to convert this multipoint feature class to a single-part one using the Multipart to Singlepart tool, but the resulting features are completely unordered and messy.

In the end, all I wanted was a safe way to find these points: enter image description here in any given scenario.

TL;DR: How to reliably find the first and last intersection points from two given lines that intersect each other multiple times along the way?

P.S.: We use ArcGIS. Although I think it's a more logic-related problem than a platform-specific one. I am aware that some RDBMS offer functions like ST_StartPoint for PostgresSQL, but I really would like to keep it a platform-agnostic, python-based solution.

P.P.S.: There are some curious edge cases that I've already stumbled upon that I think are important to point out. Here is one of them: enter image description here If you only consider absolute distances between the points and the endpoint of the green feature, the black intersection point is closer than the blue one, leading to an incorrect result. The blue dot is what we are looking for.

  • Which command did you use to perform the intersect? Did you specify LINE as output_type?
    – Berend
    Oct 28, 2021 at 13:56
  • @Berend I tried using LINE as output_type but all I got was a WARNING 000117: Warning empty output generated.. Esri states here that this is expected, unfortunately.
    – salgado
    Oct 28, 2021 at 14:20
  • Do the lines overlap exactly? If not, maybe you could apply a (small) buffer to one of the lines?
    – Berend
    Oct 28, 2021 at 15:19
  • @Berend nope. The green line represents a GPS data collection so it does not overlap exactly with the yellow feature class (which represents a highway). Now about the buffer, yeah sure. All I need is to be able to find where the GPS data leave and enters the highway. The section between those endpoints will be deleted from the green feature class anyway.
    – salgado
    Oct 28, 2021 at 15:36

1 Answer 1


The yellow line, you say is a road network, so that will break at road junctions. Your green line is constructed from GPS data, does not quite overlap the yellow lines completely.

You have run the intersect tool to create the full range of points but it is only the first and last which you have circled that you need.

If you can program in python then a simple script will be able to generate your results. You want to make use of the Polyline method measureOnLine() and you test all your points against your green line. The point that is the least and the most distance along your line are those end points you require.

So taking your image as way of example:


The 100 & 900m points are the two you require. It does not matter which way the polyline is flowing it will always be the least and most distance along the polyline that you are identifying.

  • Thanks for answering! If I understood it correctly, there is only a little problem with this approach: when the endpoint of the green line is closer to one of its inner points than the endpoint of the yellow line the result might be misleading. Here is a sample of an edge case like that. The black point is closer to the edge than the blue point.
    – salgado
    Oct 28, 2021 at 16:37
  • 1
    First always edit your question don't link out to that website, as this is a good example that needs to be accounted for. No one coming to this forum should need to go hunting for extra images on third party websites. Second I'm saying you test all your intersection points as they are what you want, not the actual vertices of the green line. So you are measuring your brown points along the green line only.
    – Hornbydd
    Oct 28, 2021 at 16:51
  • 1
    My answer still stands you are measuring along the green line only, the first point along the green line is your blue point which is what you want, the furthest point along the line is the red point on the far right which is what you want. The ends of the green line are irrelevant. See my updated answer.
    – Hornbydd
    Oct 28, 2021 at 17:59
  • 1
    Oh, now I got it! Sorry, it's quite late around here... Thank you very much for your time and patience!
    – salgado
    Oct 28, 2021 at 18:05
  • 1
    Late here in UK, off to the pub to celebrate your solution! :)
    – Hornbydd
    Oct 28, 2021 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.