Retrive the Endpoints of Lines inside Polygons

702
3
Jump to solution
03-01-2023 11:22 PM
MatsHardy
Occasional Contributor

I have a pipeline feature class (line) and a pumping station feature class (polygon). Now, I wants to retrieve the endpoints of pipelines (green points) inside pumping stations. I have used the "Intersect" geoprocessing tool but it only retrieves the intersections of pipelines and pumping stations (grey points). How can I do so by arcPy?

Pipeline_Pumping_Station.png

0 Kudos
2 Solutions

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

From How Intersect works—ArcGIS Pro | Documentation

with the intersection set to Polygon and line input for line output

You will get a line as the output.  It is just a matter then of querying the line's start and endpoint as to whether it is furthest from the edge.  One will be on the edge (Near distance of 0) and the other will be inside (Near distance > 0).  Odd cases you probably won't encounter is when the line is exactly on a polygon edge (Near distance == 0 for both)


... sort of retired...

View solution in original post

KimOllivier
Occasional Contributor III

Maybe start with a temporary layer of start nodes and end nodes from the pipelines? There is a tool to do this. Then overlays of the node points would give you the ends. Keep track of the objectids to get references to the original lines.

View solution in original post

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

From How Intersect works—ArcGIS Pro | Documentation

with the intersection set to Polygon and line input for line output

You will get a line as the output.  It is just a matter then of querying the line's start and endpoint as to whether it is furthest from the edge.  One will be on the edge (Near distance of 0) and the other will be inside (Near distance > 0).  Odd cases you probably won't encounter is when the line is exactly on a polygon edge (Near distance == 0 for both)


... sort of retired...
MatsHardy
Occasional Contributor

Many thx.

0 Kudos
KimOllivier
Occasional Contributor III

Maybe start with a temporary layer of start nodes and end nodes from the pipelines? There is a tool to do this. Then overlays of the node points would give you the ends. Keep track of the objectids to get references to the original lines.

0 Kudos