2012年5月26日 星期六

ArcGIS將Raster網格資料轉成xyz文字檔

以前在把Raster網格資料轉成xyz的表格,通常經過許多繁複的程序: Raster to point > add xy > open attribute table >export table,這幾天從ESRI網站發現原來只要一個指令就可以做到以上的步驟:

資料來源: http://support.esri.com/en/knowledgebase/techarticles/detail/26568
The following steps require the Spatial Analyst extension to be active and the Spatial Analyst toolbar to be turned on.

  1. Add the grid to ArcMap.
  2. Select the Raster Calculator option from the Spatial Analyst menu.
  3. Use the following expression in the Raster Calculator where [ingrid] is the name of the grid layer:

    outfile.txt = SAMPLE([ingrid],[ingrid])
  4. The text file called outfile.txt is written to the working directory. The working directory can be determined or set from the Spatial Analyst > Options > General tab. 

     The format of the output text file may have to be modified to be compatible with specific needs. The first and last columns in the text file are the z-values. 

     ESRI does not provide the VBA code for the above procedure. The necessary code must be developed by the user.

    翻譯
    1. 將你的grid加入ArcMap.
    2. 從 Spatial Analyst 開啟   Raster Calculator .
    3. 輸入以下的code,其中ingrid為你要轉出的檔案,例如 abc.txt = SAMPLE(C:\a1,  C:\a1 )。

      outfile.txt = SAMPLE([ingrid],[ingrid])
    4. 如果你要改輸出路徑,可以從 Spatial Analyst > Options > General tab去修改,但是其實只要在輸出檔名增加路徑即可,例如: D:\abc.txt = SAMPLE(C:\a1,  C:\a1 )