I have a vector file of lines that present a drinking water network, the objective is to correct the topographical errors of this network to have connectivity between all the lines, mainly I want to detect the isolated lines ( line Must not have two dangles ) of the network and then correct them, what is the tool that allows me to do this?
the photo shows an example of an isolated line (blue one)
Solved! Go to Solution.
This problem intrigued me. Here's one method to identify lines with two dangles. A screenshot of my test data is below. The lines are labeled with an attribute named iso_id. The line feature class is LineNetwork. Note that every line has a unique iso_id. For this process, all you really need is some sort of unique id. Obviously, OBJECTID would work here but believe me, this process will get confusing if you use the object id. If you don't have a unique id, just add one and calculate it to OBJECTID + <some value>
First step is to run the Features Vertices To Points tool with LineNetwork as the input, J_LineNetwork ("J" for Junction) as the output point feature class, and "Both start and end vertex" as the Point Type. This gives you a point feature class of the endpoints of each line. The output will have identical points -- for example, there'll be 3 points where 5001,7001, and 8500 meet and you want to get rid of them. So, run the Delete Identical tool to get rid of the duplicates. Choose "Shape" for the Field(s) parameter. Now you have a single point where lines meet. I call these points "junctions".
This next step is a bit tricky -- you're going to use Spatial Join to create a list of lines that join each junction. In network terms, this table is a kind of 'forward star', an extremely useful data structure for traversing networks. I have some Python scripts that produce a similar table with a lot less pain, but this is the way to do it with readily available tools.
Here's the input to Spatial Join:
Expand the Fields category.
Select those records where Join_Count = 1. (this isn't absolutely necessary -- it just removes a lot of noise when you run the next tool)
Run the Summary Statistics tool
Here's the output of Summary Statistics:
Any record with a FREQUENCY/SUM_Join_Count = 2 (iso_id 6599) is a line with two dangles. Any record with join count of 1 is a line with a dangle at one end. You can relate this table to the LineNetwork layer (NewField and iso_id are your join attributes), copy over the count, then use the count to select your two-dangle lines.
Caveat -- Lines with pseudo junctions are an issue with this method. A pseudo junction is a junction with two lines connecting -- a Join_Count = 2 on the J_SpatialJoin table. Imagine line 6599 with a junction somewhere along the line. In this case, there'd be two lines connecting with different iso_ids. When the above method is used, those two lines would not be identified as a line with two dangles -- because there's that pseudo junction that connects them. If you have this situation, you'll have to use the Unsplit Line tool to merge the two lines. If this is your situation, let me know and I can walk you through that process.
If y'all made it this far, thank you and congratulations.
This problem intrigued me. Here's one method to identify lines with two dangles. A screenshot of my test data is below. The lines are labeled with an attribute named iso_id. The line feature class is LineNetwork. Note that every line has a unique iso_id. For this process, all you really need is some sort of unique id. Obviously, OBJECTID would work here but believe me, this process will get confusing if you use the object id. If you don't have a unique id, just add one and calculate it to OBJECTID + <some value>
First step is to run the Features Vertices To Points tool with LineNetwork as the input, J_LineNetwork ("J" for Junction) as the output point feature class, and "Both start and end vertex" as the Point Type. This gives you a point feature class of the endpoints of each line. The output will have identical points -- for example, there'll be 3 points where 5001,7001, and 8500 meet and you want to get rid of them. So, run the Delete Identical tool to get rid of the duplicates. Choose "Shape" for the Field(s) parameter. Now you have a single point where lines meet. I call these points "junctions".
This next step is a bit tricky -- you're going to use Spatial Join to create a list of lines that join each junction. In network terms, this table is a kind of 'forward star', an extremely useful data structure for traversing networks. I have some Python scripts that produce a similar table with a lot less pain, but this is the way to do it with readily available tools.
Here's the input to Spatial Join:
Expand the Fields category.
Select those records where Join_Count = 1. (this isn't absolutely necessary -- it just removes a lot of noise when you run the next tool)
Run the Summary Statistics tool
Here's the output of Summary Statistics:
Any record with a FREQUENCY/SUM_Join_Count = 2 (iso_id 6599) is a line with two dangles. Any record with join count of 1 is a line with a dangle at one end. You can relate this table to the LineNetwork layer (NewField and iso_id are your join attributes), copy over the count, then use the count to select your two-dangle lines.
Caveat -- Lines with pseudo junctions are an issue with this method. A pseudo junction is a junction with two lines connecting -- a Join_Count = 2 on the J_SpatialJoin table. Imagine line 6599 with a junction somewhere along the line. In this case, there'd be two lines connecting with different iso_ids. When the above method is used, those two lines would not be identified as a line with two dangles -- because there's that pseudo junction that connects them. If you have this situation, you'll have to use the Unsplit Line tool to merge the two lines. If this is your situation, let me know and I can walk you through that process.
If y'all made it this far, thank you and congratulations.
Thank you so much for suggesting a solution to my problem . Your help has been invaluable and I greatly appreciate your expertise.
You're welcome!
I just submitted an Idea for this: https://community.esri.com/t5/arcgis-pro-ideas/find-orphan-lines/idi-p/1499910
If you agree with this idea, give it a Kudo - I think ideas with lots of kudos get more traction with Esri.