Instead of doing the double selections, try using a feature layer with a where clause. So replace this arcpy.SelectLayerByAttribute_management ("edge_lyr", "NEW_SELECTION", expr)
arcpy.SelectLayerByLocation_management('junc_lyr', 'intersect', 'edge_lyr') With something more like this. arcpy.MakeFeatureLayer_management(edgeSource, 'edge_lyr', expr)
arcpy.SelectLayerByLocation_management('junc_lyr', 'intersect', 'edge_lyr') Also, having nested cursors and GP tools inside a cursor are generally bad ideas. Is there no way you can avoid processing all this line by line? Thanks, Mathew, I will definitely try that. Your sense is that it would be faster to make a new feature layer every time using the expression, rather than building the selection off of an existing feature layer. Worth a shot. As mentioned, I have a technique that makes this infinitely faster using spatial overlay then processing the results. However, it only works when the data are planar embedded. If the data have a Z, I can use a 3d spatial select an junctions in one plane will select only the edges in that plane (e.g., a hwy overpass). In sort, I need the network topology that Arc is storing internally, but I cannot see any way to get that via the Python API... Again, thanks! Steve
... View more