こんにちは、<\/P>
ポイントデータセットの標高の列があります。新しい列を作成して、Row(n) と Row(n+1) の値の差を表示したいと思っています。まあ、一番簡単な方法は EXCEL で計算することだと思います(=abs(A1-A2))そして ArcGIS で結合することです。しかし、「Field calculator」でこのプロセスを行いたいと思っています。どなたか方法をご存知でしょうか?<\/P>
よろしくお願いします<\/P><\/BODY><\/HTML>
Added to Table Tools for PRO
as a field calculator sequence function
abs([field 1] - [field 2])
Hi Robert.
Value comparison in a SINGLE column.
NOT comparing field 1 and field 2.
Learn GIS ... some python?
Could make this into a script or copy and paste into the python window or your python IDE
<SPAN class="comment token"># ---- </SPAN> <SPAN class="comment token"># (1) specify the table you want to use, with the OBJECTID field and </SPAN> <SPAN class="comment token"># the field you want to get sequential differences for</SPAN> <SPAN class="comment token"># (2) convert the table to a numpy array... there is some magic in that we </SPAN> <SPAN class="comment token"># 'view' the data as double type (see the vals = line)</SPAN> <SPAN class="comment token"># (3) perform the difference, diff, by offsetting and slicing the input values)</SPAN> <SPAN class="comment token"># (4) create an output array to put the values in</SPAN> <SPAN class="comment token"># (5) 'join' permanently the result (out) to the input using the ExtendTable func</SPAN> <SPAN class="comment token">#</SPAN> <SPAN class="comment token"># ---- example below was a quick test to calculate sequential difference in 'Xs'</SPAN> flds <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'OBJECTID'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Xs'</SPAN><SPAN class="punctuation token">]</SPAN> pth <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"C:\Your_spaceless_path\Your.gdb\Your_table"</SPAN> tbl <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>TableToNumPyArray<SPAN class="punctuation token">(</SPAN>pth<SPAN class="punctuation token">,</SPAN> flds<SPAN class="punctuation token">)</SPAN> vals <SPAN class="operator token">=</SPAN> tbl<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'Xs'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>view<SPAN class="punctuation token">(</SPAN>np<SPAN class="punctuation token">.</SPAN>float64<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#</SPAN> diff <SPAN class="operator token">=</SPAN> vals<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">-</SPAN> vals<SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="comment token"># ---- changeup the function ----</SPAN> <SPAN class="comment token">#</SPAN> out <SPAN class="operator token">=</SPAN> np<SPAN class="punctuation token">.</SPAN>zeros<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>tbl<SPAN class="punctuation token">.</SPAN>shape<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><SPAN class="punctuation token">,</SPAN> dtype<SPAN class="operator token">=</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'IDs'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'<i4'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Seq_Diff'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'<f8'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> out<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'IDs'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> tbl<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'OBJECTID'</SPAN><SPAN class="punctuation token">]</SPAN> out<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'Seq_Diff'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> diff arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>ExtendTable<SPAN class="punctuation token">(</SPAN>pth<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'OBJECTID'</SPAN><SPAN class="punctuation token">,</SPAN> out<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'IDs'</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># ---- Seems like overkill? nope... I just stole the code from a pre-existing</SPAN> <SPAN class="comment token"># snippet, changed the filename, the field of interest and my amazing math function</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></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Obviously study material, but give it a try sometime.
Thanks, Dan,
I really appreciate it
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.