Is there a way to use Python to select between two different line layers (specifically, lines that are connected to each other) AND specify which attributes I want to select by?

629
3
07-19-2017 06:08 AM
MichaelHeing
New Contributor

I have two line layers in a gas distribution gdb and I want to select all of the class 6 lines that are connected to a class 5 main line, class 2 lines are connected to a main line that is NOT class 2, etc. Specifically, it is the 'connected to' aspect of this that I cannot figure out.

0 Kudos
3 Replies
ClintonDow1
Occasional Contributor II

I believe the easiest way to approach this would be to create a dictionary with keys of all the points which represent connections between pipes, and a value that is a list of all the pipe classes which connect at that point. Then for each line, check the points that touch the line for the class value matching your criteria for that selection. 

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

It would be helpful if you could provide some more information, maybe even a sample dataset.  It is the "etc." part that makes me hesitate because what I suggest will likely vary if there are 3 conditions or 30 conditions.

MichaelHeing
New Contributor

Thanks for taking a look at my question, Joshua. The different pressure classification levels are 1, 2, 5, 6, 7, and 8. These are the same classes in both the service line layer and the main line layer. I essentially need to find all the service lines that don't match the main lines regarding pressure classification. I'll try to gather some samples later this afternoon.

0 Kudos