Hi,
i have a feature layer with some records that have Shape filed with value None.
I would like update the Shape field with a correct value and i woul take it by other feature class.
I have seen some code posted here on geonet and this is my script
sourceFC <SPAN class="operator token">=</SPAN> <SPAN class="string token">'fc_lyr'</SPAN>
sourceField <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'ID_VALUE'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'SHAPE'</SPAN><SPAN class="punctuation token">]</SPAN>
valueDict <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN>r<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="punctuation token">(</SPAN>r<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">for</SPAN> r <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN>sourceFC<SPAN class="punctuation token">,</SPAN> sourceField<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">}</SPAN>
updateFieldsList <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"ID_VALUE"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Shape"</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>UpdateCursor<SPAN class="punctuation token">(</SPAN>updateFC<SPAN class="punctuation token">,</SPAN> updateFieldsList<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> updateRows<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> updateRow <SPAN class="keyword token">in</SPAN> updateRows<SPAN class="punctuation token">:</SPAN>
keyValue <SPAN class="operator token">=</SPAN> updateRow<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>keyValue<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">if</SPAN> keyValue <SPAN class="keyword token">in</SPAN> valueDict<SPAN class="punctuation token">:</SPAN>
updateRow<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> valueDict<SPAN class="punctuation token">[</SPAN>keyValue<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>valueDict<SPAN class="punctuation token">[</SPAN>keyValue<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
updateRows<SPAN class="punctuation token">.</SPAN>updateRow<SPAN class="punctuation token">(</SPAN>updateRow<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>whit this script the field Shape is not update, but if i change the field Shape with some other field and try to update it, the update works.
Why the Sahpe field is not update???
Thanks