AnsweredAssumed Answered

ArcPy: Can somebody explain this piece of code.

Question asked by vonmoosa on Jun 22, 2018
Latest reply on Sep 15, 2018 by Dan_Patterson

The script below field calculates the UGA feature UGA attribute in the Address feature UGA field. I can't remember exactly how I created this script but it works. Can someone explain which UGA in the script below is the UGA feature, UGA feature attribute name, or the Address UGA attribute name.


arcpy.MakeFeatureLayer_management("G:\GIS\Anthony\Workspaces\Planning\Addressing_Tool 62018\Data\gdb\Addressing.gdb\Address", "Address_lyr")
arcpy.MakeFeatureLayer_management("G:\GIS\Anthony\Workspaces\Planning\Addressing_Tool 62018\Data\gdb\Addressing.gdb\UGA", "UGA_lyr")

rows = arcpy.SearchCursor("UGA")
for row in rows:

     arcpy.SelectLayerByAttribute_management("UGA", "NEW_SELECTION", "\"OBJECTID\" = " + str(row.getValue("OBJECTID")))
     arcpy.SelectLayerByLocation_management("Address", "INTERSECT", "UGA", "", "NEW_SELECTION")
     arcpy.CalculateField_management("Address", "UGA", "'{0}'".format(str(row.getValue("UGA"))), "PYTHON_9.3", "")