import arcpy # Set Geoprocessing environments arcpy.env.scratchWorkspace = "F:\\ArcGISServer\\DataProcessing\\Mobile_Parcels\\TestData\\Testing.gdb" arcpy.env.workspace = "F:\\ArcGISServer\\DataProcessing\\Mobile_Parcels\\TestData\\Testing.gdb" arcpy.env.overwriteOutput = True # Add code to generate target address list (dataset) addrList_fc = "F:\\ArcGISServer\\DataProcessing\\Mobile_Parcels\\TestData\\Testing.gdb\\addresspts_LeftOut_tmpSel" # Loop through the address list dataset created above; check for parcel# match against target parcels dataset from earlier script; # create duplicate parcel & populate FULL_ADD targetParcels = "F:\\ArcGISServer\\DataProcessing\\Mobile_Parcels\\TestData\\Testing.gdb\\target_parcels_sample" cursor2 = arcpy.da.SearchCursor(targetParcels, ["ASSESSORSI", "*", "SHAPE@"]) ## Maybe use ["ASSESSORSI", "FULL_ADD", "*"] inCur = arcpy.da.InsertCursor(targetParcels, ["ASSESSORSI", "*", "SHAPE@"]) # Loop thru the address dataset with arcpy.da.SearchCursor(addrList_fc, ["PARCELNO", "FSA"]) as cursor1: for rowAddr in cursor1: # Grab the address value from address dataset fsa = rowAddr[1] cursor2.reset() # Loop thru the parcel dataset for rowParcel in cursor2: if rowAddr[0] == rowParcel[0]: # Compare parcel # values for a match # If there is a match, use current parcel record to create a duplicate parcel and insert the current address value # into the parcels FULL_ADD field (don't know how to accomplish this last part) inCur.insertRow(rowParcel) break # and get out of inner For Loop and proceed back to outer For Loop #else, continue with the next row in the inner For Loop del cursor1, cursor2, inCur, rowParcel, rowAddr print "Script completed"
Solved! Go to Solution.
import arcpy # Set Geoprocessing environments arcpy.env.scratchWorkspace = "F:\\ArcGISServer\\DataProcessing\\Mobile_Parcels\\TestData\\Testing.gdb" arcpy.env.workspace = "F:\\ArcGISServer\\DataProcessing\\Mobile_Parcels\\TestData\\Testing.gdb" arcpy.env.overwriteOutput = True # Add code to generate target address list (dataset). addrList_fc = "F:\\ArcGISServer\\DataProcessing\\Mobile_Parcels\\TestData\\Testing.gdb\\addresspts_LeftOut_tmpSel" # Loop through the address list dataset created above; check for parcel# match against target parcels dataset from earlier script; # create duplicate parcel & populate FULL_ADD targetParcels = "F:\\ArcGISServer\\DataProcessing\\Mobile_Parcels\\TestData\\Testing.gdb\\target_parcels_sample" cursor2 = arcpy.da.SearchCursor(targetParcels, ["ASSESSORSI", "*", "SHAPE@"]) inCur = arcpy.da.InsertCursor(targetParcels, ["ASSESSORSI", "*", "SHAPE@"]) # Loop thru the address dataset with arcpy.da.SearchCursor(addrList_fc, ["PARCELNO", "FSA"]) as cursor1: for rowAddr in cursor1: # Grab the address value from address dataset fsa = rowAddr[1] cursor2.reset() # Loop thru the parcel dataset for rowParcel in cursor2: if rowAddr[0] == rowParcel[0]: # Compare parcel # values for a match # If there is a match, use current parcel record to create a duplicate parcel and insert the current address value # into the parcels FULL_ADD field. # Convert the row tuple to a list so values can be changed tmpList = list(rowParcel) # Update the situs address value in the list tmpList[11] = fsa # Now convert the list back into a tuple dupRow = tuple(tmpList) inCur.insertRow(dupRow) break # and get out of inner For Loop and proceed back to outer For Loop #else, continue with the next row in the inner For Loop del cursor1, cursor2, inCur, rowParcel, rowAddr print "Script completed"