כלי קטן  להשוואת שדות בין 2 שכבות

לא פעם יוצא לנו לעדכן שכבות וקבצים וכדי להיות בטוחים שאין לנו שינוי בשדות בין הקבצים השונים כתבתי את הכלי הבא (להורדה)

נבחר את השכבות להשוואה

במידה ויש הבדלים בין השכבות נקבל בירוק את השדות היחודיים בכל שכבה

 

 

הקוד:

import arcpy


FieldA = arcpy.GetParameterAsText(0)
FieldB = arcpy.GetParameterAsText(1)

FieldA=FieldA.encode('utf-8')
FieldA_name=str(FieldA).split("\\")[-1]
FieldB=FieldB.encode('utf-8')
FieldB_name=str(FieldB).split("\\")[-1]

fieldListA=[]
fieldListB=[]
copm =True
for f in arcpy.ListFields(FieldA):
fieldListA.append(f.name)


for g in arcpy.ListFields(FieldB):
fieldListB.append(g.name)

diff=list(set(fieldListA) - set(fieldListB))

diffB=list(set(fieldListB) - set(fieldListA))

if len (diff)>0: 
arcpy.AddWarning ("the fields: {0} are only in {1}".format(diff,FieldA_name))
arcpy.AddWarning ("the fields: {0} are only in {1}".format(diffB,FieldB_name))
copm =False
if copm ==True:
arcpy.AddMessage("------The both Layer are same------")
[elementor-template id="1652"]