Network topology errors

275
3
Jump to solution
04-16-2024 02:06 AM
Labels (1)
Bisacqatesta
New Contributor

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?

Bisacqatesta_0-1713258272709.png

the photo shows an example of an isolated line (blue one)

0 Kudos
1 Solution

Accepted Solutions
Dale_Honeycutt
Occasional Contributor II

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>  

Dale_Honeycutt_0-1713328286554.png

 

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:

  • Target Features = J_LineNetwork
  • Join Features = LineNetwork
  • Output Feature Class = J_SpatialJoin
  • Join Operation = "Join one-to-one"
  • Keep All Target Features = checked (true)
  • Match Option = Intersect
  • Search Radius - you shouldn't need one, but you can enter a small radius appropriate for your data

Expand the Fields category.  

  1. Click Edit
    Dale_Honeycutt_1-1713329482310.png
  2. Remove all the fields on the left by selecting them and deleting with the red X
    Dale_Honeycutt_2-1713329559108.png
  3. Add an Empty Field.  By default, the field is named NewField , a text field 255 in length.  You can change it if you want, but keep it text and 255 long.
    Dale_Honeycutt_3-1713329625893.png
  4. For Action, chose Concatenate
    Dale_Honeycutt_4-1713329845482.png
  5. Select LineNetwork for Table
    Dale_Honeycutt_5-1713329917182.png
  6. Select iso_id for the Field.  The dialog should look like this:
    Dale_Honeycutt_6-1713330000604.png
  7. Click OK and run the tool.  The output table will look like this:
    Dale_Honeycutt_7-1713330074823.png
  8. Join_Count is the number of lines connected to the junction (sometimes called 'valence' or 'degree') and NewField is a list of the lines (by iso_id) that connect to that junction.  Note iso_id 6599 - it is made up of two dangles - junctions with only one line connected to it.  Other records where Join_Count = 1 have dangling junctions but are connected to other non-dangling junctions.  For example, iso_id 5001 appears in records 1 and 5.  TARGET_FID is the object id of J_LineNetwork.

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

  1. Input Table = J_SpatialJoin
  2. Use the selected records is toggled on
  3. Statistics Fields = Join_Count with Statistic Type = Sum
  4. Case Field = NewField

Here's the output of Summary Statistics:
Dale_Honeycutt_8-1713330827336.png

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. 

 

 

 

View solution in original post

0 Kudos
3 Replies
Dale_Honeycutt
Occasional Contributor II

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>  

Dale_Honeycutt_0-1713328286554.png

 

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:

  • Target Features = J_LineNetwork
  • Join Features = LineNetwork
  • Output Feature Class = J_SpatialJoin
  • Join Operation = "Join one-to-one"
  • Keep All Target Features = checked (true)
  • Match Option = Intersect
  • Search Radius - you shouldn't need one, but you can enter a small radius appropriate for your data

Expand the Fields category.  

  1. Click Edit
    Dale_Honeycutt_1-1713329482310.png
  2. Remove all the fields on the left by selecting them and deleting with the red X
    Dale_Honeycutt_2-1713329559108.png
  3. Add an Empty Field.  By default, the field is named NewField , a text field 255 in length.  You can change it if you want, but keep it text and 255 long.
    Dale_Honeycutt_3-1713329625893.png
  4. For Action, chose Concatenate
    Dale_Honeycutt_4-1713329845482.png
  5. Select LineNetwork for Table
    Dale_Honeycutt_5-1713329917182.png
  6. Select iso_id for the Field.  The dialog should look like this:
    Dale_Honeycutt_6-1713330000604.png
  7. Click OK and run the tool.  The output table will look like this:
    Dale_Honeycutt_7-1713330074823.png
  8. Join_Count is the number of lines connected to the junction (sometimes called 'valence' or 'degree') and NewField is a list of the lines (by iso_id) that connect to that junction.  Note iso_id 6599 - it is made up of two dangles - junctions with only one line connected to it.  Other records where Join_Count = 1 have dangling junctions but are connected to other non-dangling junctions.  For example, iso_id 5001 appears in records 1 and 5.  TARGET_FID is the object id of J_LineNetwork.

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

  1. Input Table = J_SpatialJoin
  2. Use the selected records is toggled on
  3. Statistics Fields = Join_Count with Statistic Type = Sum
  4. Case Field = NewField

Here's the output of Summary Statistics:
Dale_Honeycutt_8-1713330827336.png

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. 

 

 

 

0 Kudos
Bisacqatesta
New Contributor

Thank you so much  for suggesting a solution to my problem . Your help has been invaluable and I greatly appreciate your expertise.

Dale_Honeycutt
Occasional Contributor II

You're welcome!

0 Kudos