AnsweredAssumed Answered

Compare field attributes

Question asked by CCweedcontrol on Mar 23, 2016
Latest reply on Mar 23, 2016 by CCweedcontrol

I have a points layer  and polygon layer , I need to compare field "SiteAddres" from the points layer to "SiteAddress" to the polygon layer and if it matches i need it to populate field "Verifi" with "Match" or if it doesn't match to populate "Verifi" with "No Match".  Although i am not sure what would be the best way to achieve what i am trying to do because i am trying to compare address which will have upper case and lower case and spaces. I would prefer not to do a spatial join every time i need to verify and i looked into doing it with a python script but i am not sure how to do it?

 

 

I get no error but nothing the field "Verifi" doens't get populated with "Match" or "No Match"

fc1 = "Points"
fc2 = "Polygons"

cursor1 = arcpy.da.SearchCursor(fc1, ["SiteAddres", "Verifi"])
cursor2 = arcpy.da.SearchCursor(fc2, ["SiteAddres"])

for row1 in cursor1:
    for row2 in cursor2:  
        if row2[0] == row1[0]:
            for row1 in cursor1:
                row1[1] = "Match"
            else:
                row1[1] = "No Match"

 

I tried spatially joining the two layers and using field calculator but i am getting an invalid syntex error on line 2.

 

def ifBlock( SiteAddres , [SiteAddr_1 ):
 if SiteAddres = =SiteAddr_1:
  return "Match"
 else:
  return" No Match"

ifBlock( SiteAddres , SiteAddr_1 )

 

Thanks.

Outcomes