<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Copy Row fromr spatial Join featues in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32616#M2581</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;yes a Python add-in for ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't understand what the r in r.JOIN_FID and the r or the f in [r.getvalue (f) is?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How are you passing the arguments in the function of the script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have always passed them like you posted.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;fcTarget = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fcJoin = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Feb 2014 21:39:10 GMT</pubDate>
    <dc:creator>TonyAlmeida</dc:creator>
    <dc:date>2014-02-19T21:39:10Z</dc:date>
    <item>
      <title>Copy Row fromr spatial Join featues</title>
      <link>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32608#M2573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to populate some fields from the spatial join features but i am not getting it to populate.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The idea is to create a point feature and have that point feature populated with x,y and AddressID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code currently works but does not populate the ACCOUNT,OwnerName, SiteAddres from the parcels.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;current code&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
fcTarget = 'TonyTwoWay.DBO.TT'&amp;nbsp;&amp;nbsp; #Points
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcJoin = 'testParcelsAdmint'&amp;nbsp;&amp;nbsp;&amp;nbsp; #Parcels
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcOutput = 'Points_joined'&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SpatialJoin_analysis(fcTarget, fcJoin, fcOutput, 'JOIN_ONE_TO_ONE', 'KEEP_COMMON')

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curR = arcpy.SearchCursor(fcOutput, '', '', '', 'AddressID A')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curW = arcpy.UpdateCursor(fcTarget, '', '', '', 'AddressID A')

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # init rowW and rowR
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowW = curW.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowR = curR.next()

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while rowR:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentAddress = rowR.AddressID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'current add: ' + currentAddress
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while rowW.AddressID != currentAddress:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowW = curW.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if rowW.ACCOUNT == rowR.ACCOUNT_1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowW.OwnerName = rowR.OwnerName_1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowW.SiteAddres = rowR.SiteAddres_1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # etc., etc., fill in the rest
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curW.updateRow(rowW)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowR = curR.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # changed the delete statement, targeting the cursor objs (rather than the row objs)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del rowW, rowR
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 15:27:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32608#M2573</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2014-02-14T15:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Row fromr spatial Join featues</title>
      <link>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32609#M2574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you get a print out of what rowR.OwnerName_1 and rowR.SiteAddres_1 are being populated with?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 15:32:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32609#M2574</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2014-02-14T15:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Row fromr spatial Join featues</title>
      <link>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32610#M2575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OwnerName will be populated with "John Doe" &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rowW.SiteAddres will be populated "with 1245 Hall st"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have attached a table after the spatial join.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and some sample data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your response and help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 15:50:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32610#M2575</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2014-02-14T15:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Row fromr spatial Join featues</title>
      <link>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32611#M2576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I am trying to populate some fields from the spatial join features but i am not getting it to populate.&lt;BR /&gt;The idea is to create a point feature and have that point feature populated with x,y and AddressID&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Any help would be greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;The code currently works but does not populate the ACCOUNT,OwnerName, SiteAddres from the parcels.&lt;BR /&gt;&lt;BR /&gt;current code&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
fcTarget = 'TonyTwoWay.DBO.TT'&amp;nbsp;&amp;nbsp; #Points
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcJoin = 'testParcelsAdmint'&amp;nbsp;&amp;nbsp;&amp;nbsp; #Parcels
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcOutput = 'Points_joined'&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SpatialJoin_analysis(fcTarget, fcJoin, fcOutput, 'JOIN_ONE_TO_ONE', 'KEEP_COMMON')

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curR = arcpy.SearchCursor(fcOutput, '', '', '', 'AddressID A')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curW = arcpy.UpdateCursor(fcTarget, '', '', '', 'AddressID A')

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # init rowW and rowR
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowW = curW.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowR = curR.next()

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while rowR:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentAddress = rowR.AddressID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'current add: ' + currentAddress
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while rowW.AddressID != currentAddress:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowW = curW.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if rowW.ACCOUNT == rowR.ACCOUNT_1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowW.OwnerName = rowR.OwnerName_1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowW.SiteAddres = rowR.SiteAddres_1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # etc., etc., fill in the rest
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curW.updateRow(rowW)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowR = curR.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # changed the delete statement, targeting the cursor objs (rather than the row objs)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del rowW, rowR
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't use the old cursors.&amp;nbsp; Use da. cursor only.&amp;nbsp; The speed difference is more than 10 times as fast.&amp;nbsp; Populate a list or dictionary with the read cursor once and then process the write cursor to locate the match in the list or dictionary.&amp;nbsp; That will improve speed 100 fold.&amp;nbsp; The code you have would work insanely slow with any large dataset.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You logic is wrong for embedded cursors.&amp;nbsp; But embedded cursors suck.&amp;nbsp; But to do what you want you have to reinitialize the write cursor inside the read cursor for every row read.&amp;nbsp; For every record read the entire write cursor has to be restarted and reprocessed.&amp;nbsp; Very bad for memory and speed.&amp;nbsp; If you had 1,000 read records and 1,000 write records you would have to process close to 1,000,000 cursor next statements.&amp;nbsp; That is 1,000,000 hits to your hard drive.&amp;nbsp; Insane.&amp;nbsp; Querying a list or dictionary from memory is the only way to do this and have any speed worth spit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The inner loop condition needs to check for the current address and the addressID match in one conditional statement, not separate statements.&amp;nbsp; If a currentaddress is match but an AddressID is not no more rows will be read and nothing will be written.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As written the write cursor never reads backwards for currentaddresses that were skipped by the previous current address and once you finish going through the set of the write addresses once, you are not going to write anything else.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:17:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32611#M2576</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-10T21:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Row fromr spatial Join featues</title>
      <link>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32612#M2577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Seems like this would require some one with good knowledgeable of python. I am a newbie to python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not sure how dictionary would create a spatial join. If it's not to much to ask i would like to see my data in the code you are describing. if anyone could help me out i would gratefully appreciative.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2014 14:51:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32612#M2577</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2014-02-19T14:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Row fromr spatial Join featues</title>
      <link>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32613#M2578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You were close....The below code worked for me.&amp;nbsp; I discarded the output fc since it didn't seem like you were using it for anything.&amp;nbsp; I added a different parameter called add fields so you can just select all the fields you want from the parcels filled in to the target points.&amp;nbsp; Try the attached toolbox.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
arcpy.env.overwriteOutupt = True

def joinAtts(fcTarget, fcJoin,&amp;nbsp; add_fields):

&amp;nbsp;&amp;nbsp;&amp;nbsp; # fix args
&amp;nbsp;&amp;nbsp;&amp;nbsp; if type(add_fields) != list:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # from script tool
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add_fields = add_fields.split(';')

&amp;nbsp;&amp;nbsp;&amp;nbsp; # do not need this scratch file
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcOutput = r'in_memory\temp_join'
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SpatialJoin_analysis(fcJoin, fcTarget,fcOutput, 'JOIN_ONE_TO_MANY')


&amp;nbsp;&amp;nbsp;&amp;nbsp; # grab oid field from points
&amp;nbsp;&amp;nbsp;&amp;nbsp; oid_t = arcpy.Describe(fcTarget).OIDFieldName

&amp;nbsp;&amp;nbsp;&amp;nbsp; # init rowW and rowR
&amp;nbsp;&amp;nbsp;&amp;nbsp; curR = arcpy.SearchCursor(fcOutput)
&amp;nbsp;&amp;nbsp;&amp;nbsp; join_dict = dict([(r.JOIN_FID,[r.getValue(f) for f in add_fields]) for r in curR])
&amp;nbsp;&amp;nbsp;&amp;nbsp; del curR

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Now update the new target
&amp;nbsp;&amp;nbsp;&amp;nbsp; curW = arcpy.UpdateCursor(fcTarget)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curW:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t_oid = row.getValue(oid_t)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if t_oid in join_dict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for f in add_fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(f, join_dict[t_oid][add_fields.index(f)])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curW.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp; del row, curW
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage('Updated all records sucussefully')
&amp;nbsp;&amp;nbsp;&amp;nbsp; return

if __name__ == '__main__':

&amp;nbsp;&amp;nbsp;&amp;nbsp; # grab args
&amp;nbsp;&amp;nbsp;&amp;nbsp; argv = tuple(str(arcpy.GetParameterAsText(i)) for i in range(arcpy.GetArgumentCount()))

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Run it
&amp;nbsp;&amp;nbsp;&amp;nbsp; joinAtts(*argv)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:17:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32613#M2578</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-10T21:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Row fromr spatial Join featues</title>
      <link>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32614#M2579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Caleb1987 that's pretty neat.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would prefer this to be in a tool, because the two targets would not change nor would the fields that would be copied.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would modify it my self but i am not to familiar on what's going on in the code. I would also like to combine it with the creating feature points from my first post.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you describe what is going here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dict([(r.JOIN_FID,[r.getValue(f) for f in add_fields]) for r in curR])&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How are you getting the input parameters into the script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I see argv = tuple(str(arcpy.GetParameterAsText(i)) for i in range(arcpy.GetArgumentCount())) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;but i am not sure how it's going into the code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2014 20:17:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32614#M2579</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2014-02-19T20:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Row fromr spatial Join featues</title>
      <link>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32615#M2580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Caleb1987 that's pretty neat.&lt;BR /&gt;&lt;BR /&gt;I would prefer this to be in a tool, because the two targets would not change nor would the fields that would be copied.&lt;BR /&gt;I would modify it my self but i am not to familiar on what's going on in the code. I would also like to combine it with the creating feature points from my first post.&lt;BR /&gt;&lt;BR /&gt;Could you describe what is going here?&lt;BR /&gt;dict([(r.JOIN_FID,[r.getValue(f) for f in add_fields]) for r in curR])&lt;BR /&gt;&lt;BR /&gt;How are you getting the input parameters into the script.&lt;BR /&gt;I see argv = tuple(str(arcpy.GetParameterAsText(i)) for i in range(arcpy.GetArgumentCount())) &lt;BR /&gt;but i am not sure how it's going into the code.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Tony,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure what you mean by preferring it in a tool?&amp;nbsp; I attached a toolbox that has a script tool in for this python script.&amp;nbsp; Or do you mean as a Python add-in for ArcMap?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dict([(r.JOIN_FID,[r.getValue(f) for f in add_fields]) for r in curR])
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is creating a python dictionary.&amp;nbsp; These store key : value pairs.&amp;nbsp; In this case, I am taking the OID (TARGET_FID field) of the spatial join as the key for each row in the parcels and then the value is a list of the values of all the fields to be added back into the points ['OwnerName','ACCOUNT','SiteAddress'].&amp;nbsp; This is used later to add these values to the point based on the OID in the points being matched to the TARGET_FID field in the dictionary from the spatial join.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This part:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
argv = tuple(str(arcpy.GetParameterAsText(i)) for i in range(arcpy.GetArgumentCount())) &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is just creating a tuple of all the arguments that will be passed into the function from the script tool interface.&amp;nbsp; I like to do it that way because it keeps it dynamic and I don't have to type something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;fcTarget = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fcJoin = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;etc...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a screenshot of the tool in the attached toolbox from the last post:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]31597[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:17:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32615#M2580</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-10T21:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Row fromr spatial Join featues</title>
      <link>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32616#M2581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;yes a Python add-in for ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't understand what the r in r.JOIN_FID and the r or the f in [r.getvalue (f) is?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How are you passing the arguments in the function of the script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have always passed them like you posted.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;fcTarget = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fcJoin = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2014 21:39:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-row-fromr-spatial-join-featues/m-p/32616#M2581</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2014-02-19T21:39:10Z</dc:date>
    </item>
  </channel>
</rss>

