Tonyalmeida

Copy Row fromr spatial Join featues

Discussion created by Tonyalmeida on Feb 14, 2014
Latest reply on Feb 19, 2014 by Tonyalmeida
I am trying to populate some fields from the spatial join features but i am not getting it to populate.
The idea is to create a point feature and have that point feature populated with x,y and AddressID
And info from the Parcels. This would be used as tool so i don't have to manually enter the information especially when i am creating a lot of points.

The fcJoin do not have an AddressID, so i have tried to use ACCOUNT to sort because both fcJoin and fcTarget have the ACCOUNT field but nothing gets populated.

Any help would be greatly appreciated.

The code currently works but does not populate the ACCOUNT,OwnerName, SiteAddres from the parcels.

current code
fcTarget = 'TonyTwoWay.DBO.TT'   #Points
        fcJoin = 'testParcelsAdmint'    #Parcels
        fcOutput = 'Points_joined'  

        arcpy.SpatialJoin_analysis(fcTarget, fcJoin, fcOutput, 'JOIN_ONE_TO_ONE', 'KEEP_COMMON')

        curR = arcpy.SearchCursor(fcOutput, '', '', '', 'AddressID A')
        curW = arcpy.UpdateCursor(fcTarget, '', '', '', 'AddressID A')

        # init rowW and rowR
        rowW = curW.next()
        rowR = curR.next()

        while rowR:
            currentAddress = rowR.AddressID
            print 'current add: ' + currentAddress
            while rowW.AddressID != currentAddress:
                rowW = curW.next()
            if rowW.ACCOUNT == rowR.ACCOUNT_1:
                 rowW.OwnerName = rowR.OwnerName_1
                 rowW.SiteAddres = rowR.SiteAddres_1
                 # etc., etc., fill in the rest
            curW.updateRow(rowW)
            rowR = curR.next()
        # changed the delete statement, targeting the cursor objs (rather than the row objs)
        del rowW, rowR

Outcomes