This is a new script that i am trying to build and get working. I am not sure if it's working or not because when i run it the script that i posted above ArcMap just sits there thinking and thinking, i eventually have to use task manager to close arc map. I believe my problem is that the script takes every point and every taxparcels in the spatial join instead of just the newly point and the taxparcel it sits on. but i am not 100% certain becasue my python is not very good.what i have been trying to is do a select by location on the parcel layer to see what parcel the new point sits on then populate/copy the point with certain fields from that selected parcel only.I have separated the two functions and they run great separated but not together.This function of this script runs flawless by it's self and as long as the point is selected. except for the "OBJECTID" does not get populated.I create points in arcmap manually with the create features/construction tool then select them with the selection tool and run the following the points get populated with the parcel info it sits on only.fcTarget = "Points_3"
workspace = r"C:\Temp\default.gdb"
#workspace = r"C:\Users\talmeida\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\Connection to dsd15_sqlexpress.sde"
arcpy.env.overwriteOutput = True
####Select by location on parcels with created point
Parcellyr = "testParcelsAdmit"
arcpy.MakeFeatureLayer_management(Parcellyr, "Parcel layer")
entries = int(arcpy.GetCount_management(fcTarget).getOutput(0))
for i in xrange(entries):
arcpy.MakeFeatureLayer_management(fcTarget, "point layer", "\"OBJECTID\"={}".format(str(i)))
arcpy.SelectLayerByLocation_management("Parcel layer", "INTERSECT", fcTarget, "", "NEW_SELECTION")
#if arcpy.Exists(pt_lyr): arcpy.Delete_management(pt_lyr)
#### populates fields
add_fields = ["ACCOUNT","SiteNum","OwnerName","SiteAddres","SiteNumSfx","SiteStreet","predir","StreetType","SubName"]
# fix args
if not isinstance(add_fields, list):
# from script tool
add_fields = add_fields.split(';')
# do not need this scratch file
fcOutput = r'in_memory\temp_join'
arcpy.SpatialJoin_analysis("Parcel layer", fcTarget, fcOutput, 'JOIN_ONE_TO_MANY', 'KEEP_COMMON')
# grab oid field from points
oid_t = arcpy.Describe(fcTarget).OIDFieldName
# init rowW and rowR
curR = arcpy.SearchCursor(fcOutput)
join_dict = dict([(r.JOIN_FID,[r.getValue(f) for f in add_fields]) for r in curR])
del curR
# Now update the new target
curW = arcpy.UpdateCursor(fcTarget)
for row in curW:
t_oid = row.getValue(oid_t)
if t_oid in join_dict:
for f in add_fields:
row.setValue(f, join_dict[t_oid][add_fields.index(f)])
curW.updateRow(row)
del row, curW
arcpy.Delete_management(r"in_memory\temp_join")
arcpy.AddMessage('Updated all records sucussefully')
Would some sample data help?