1

I have a Polyline feature class. For each feature in the Fc...I want the list of all the connecting lines(A table). For Example For Feature 17686 Connecting Id are : 17688 & 17684. For Reference :
enter image description here

2

1 Answer 1

5

Derive lines end points, delete spatially identical, name points and transfer their attributes to lines table:

enter image description here enter image description here

Export lines table to 2 identical stand-alone table in GDB, e.g. ABC and CBA and Make Query Table No1:

enter image description here

Repeat to create Query Table No2 and 3, using:

ABC.ton = BCA.fromn
and
ABC.ton = BCA.ton

You'll need to export all query tables and concatenate them. Table below shows all lines connected to line 612, compare it with 1st picture:

enter image description here

This hectic workflow can be replaced by tiny field calculator expression:

import collections
from collections import defaultdict
dF,dT=defaultdict(list),defaultdict(list)
tbl=arcpy.da.TableToNumPyArray("LINKS",("LINKNO" , "fromn" , "ton"))
for i,f,t in tbl:
 dF[f]+=[str(i)]; dF[t]+=[str(i)]
 dT[t]+=[str(i)]; dT[f]+=[str(i)]

def getConnected(i,f,t):
 bigList = set(dF[f]+dT[t])
 bigList.remove(str(i))
 return ','.join(list(bigList))
#-----
getConnected( !LINKNO!, !fromn! , !ton! )

enter image description here

Use python, I think there is a need for one more query table if there are more than one line going out from FromNode:(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.