I have a large electrical network here I post only a small part of the network. An image file is attached.
In the image, I tried to show the line sketch where each line is apart but they connected to there adjacent vertex.
My expectation is all line features of the same value of q50 field remain continuous they should not discontinue.
My First Attempt:
import arcpy
arcpy.env.workspace = r"G:\1. DESCO\2. SND\DESCO_GIS.mdb"
Table = r"G:\1. DESCO\2. SND\DESCO_GIS.mdb\SNDLT"
Output = r"G:\1. DESCO\2. SND\DESCO_GIS.mdb\SNDLT_Disslove"
arcpy.env.workspace = r"G:\1. DESCO\2. SND\DESCO_GIS.mdb"
Table = arcpy.GetParameterAsText(0)
# Make a list of q01 field
FromPole = []
cursor = arcpy.da.SearchCursor(Table, ["q01"])
for row in cursor:
if row[0] not in FromPole:
FromPole.append(row[0])
del cursor
# Make a list of q41 field
ToPole = []
cursor = arcpy.da.SearchCursor(Table, ["q41"])
for row in cursor:
if row[0] not in ToPole:
ToPole.append(row[0])
del cursor
# Make a list of q50 field
DT_ID = []
cursor = arcpy.da.SearchCursor(Table, ["q50"])
for row in cursor:
if row[0] not in DT_ID:
DT_ID.append(row[0])
del cursor
# Add a Status field
if len(arcpy.ListFields(Table, "Status")) > 0:
arcpy.AddMessage("Dup Field Exists")
else:
arcpy.management.AddField(Table, "Status", "SHORT")
upCur = arcpy.da.UpdateCursor(Table, ["q01", "q41", "q50", "Status"])
for row in upCur:
if row[2] in DT_ID:
if row[0] in FromPole
I have not codded anymore
Please help
My Second Attempts:
I Dissolve the Layer based on q50 Field.
arcpy.Dissolve_management(Table, Output, "q50", " ", " ", " ")
My Expected Output:
OID Shape_Length Line_color q01 q41 q50 Status
1 30.398597 Blue 100 101 KB_40 TRUE
2 30.398597 Blue 101 102 KB_50 FALSE
3 28.935468 Blue 101 103 KB_40 TRUE
4 28.098186 Blue 103 104 KB_40 TRUE
5 17.087751 Blue 104 105 KB_40 TRUE
6 24.486309 Blue 101 107 KB_40 TRUE
7 10.6042869 Blue 107 106 KB_40 TRUE
8 27.879100 Blue 107 108 KB_40 TRUE
9 30.116200 Blue 108 109 KB_40 TRUE
10 26.952097 Blue 109 110 KB_40 TRUE
11 30.398597 Orange 110 111 KB_50 TRUE
12 30.398597 Orange 110 119 KB_50 TRUE
13 30.398597 Orange 119 118 KB_50 TRUE
14 30.398597 Orange 118 117 KB_50 TRUE
15 30.398597 Orange 117 116 KB_50 TRUE
16 30.398597 Orange 117 120 KB_40 FALSE
17 30.398597 Orange 111 112 KB_50 TRUE
18 30.398597 Orange 112 113 KB_50 TRUE
19 30.398597 Orange 113 114 KB_50 TRUE
20 30.398597 Orange 114 115 KB_50 TRUE