I'm trying to write a standalone script to copy the values from 6 fields in a feature class to another feature class based on a spatial join and name query. I am stuck at updating the values from the join table to my original table.
print "Importing modules..."
import sys, arcpy, traceback
arcpy.env.workspace = r"C:\LVS\PECO\PECO\Python\Python\Script\test_code.gdb\GAS"
arcpy.env.overwriteOutput = True
# Local variables:
GFR = "GFR"
Parcel = "PECO_TaxParcels"
GFR_SpatialJoin = "C:\\Users\\aadeyemo\\Documents\\ArcGIS\\Default.gdb\\GFR_SpatialJoin"
arcpy.MakeFeatureLayer_management("GFR", GFR)
arcpy.MakeFeatureLayer_management("PECO_TaxParcels", Parcel)
# Process: Select Layer By Attribute
arcpy.SelectLayerByAttribute_management(GFR, "NEW_SELECTION", "STREET_NAME IS NULL")
# Process: Spatial Join
arcpy.SpatialJoin_analysis(GFR, Parcel, GFR_SpatialJoin, "JOIN_ONE_TO_ONE", "KEEP_ALL")
path_dict1 = {}
SC1 = arcpy.da.SearchCursor (GFR_SpatialJoin, ["TARGET_FID", "STHSNUM", "STSTNAME", "STSUFFIX", "STCITY", "STSTATE", "STZIP"])
for row in SC1:
path_dict1[ row[0] ] = row[1]
print SC1[1]
print path_dict1
del row
ucursor = arcpy.da.UpdateCursor(GFR, ["OBJECTID", "STREET_NUMBER", "STREET_NAME", "STREET_SUFFIX", "CITY", "STATE", "ZIP_CODE"])
for urow in ucursor:
if path_dict1.has_key( urow[0]):
urow[1] = path_dict1[0]
This currently returns a value of zero when i try to copy values.
Solved! Go to Solution.
sort of... but you have to specify the language... I took the liberties, have a look-see