I have a point shapefile that contains all my field collected data, lat/long and all the field data collected during the season. The one thing not imported was the name of the Lakes these points fell on. I have a polygon data set that has the name of the lake. What I want to accomplish without creating another data set is to have the Lake name populated for each point that falls within the lake. Some of my lakes do not have names so some will have blank records if that makes a difference. I was trying to accomplish this with python code that I found around the net trying to accomplish the same thing. I tried importing it into the ArcGIS addin assistant that lets you create buttons with python code running them. Here is the code I have so far that is not working. I click the button and nothing happens.
import arcpy import pythonaddins class Transfer(object): """Implementation for AIS_Transfer_addin.tool (Button)""" def __init__(self): self.enabled = True self.checked = False def onClick(self): pythonaddins.MessageBox ('Attributes have been Transfered!', 'Message', 0) arcpy.env.overwriteOutput = True arcpy.MakeFeatureLayer_management('E:\Violations\AIS_Registry\MISIN_Source_Data_All_20181120.shp','lyr_Source') arcpy.MakeFeatureLayer_management('E:\Violations\AIS_Registry\Michigan_Lakes_All_v3.shp','lyr_lakes') rows = arcpy.SearchCursor(lyr_lakes) for row in rows: arcpy.SelectLayerByAttribute_management('lyr_lakes', 'NEW_SELECTION', '\'FID\' = ' + str(row.getValue('FID'))) arcpy.SelectLayerByLocation_management('lyr_source', INTERSECT, 'lyr_lakes', '', 'NEW_SELECTION') arcpy.CalculateField_management('lyr_source', 'Lake_Name', "''".format(str(row.getValue('Label'))), 'PYTHON_9.3', '') print 'Finished processing' + str(row.getValue('Label'))