ArcGIS 10 影像、栅格数据格式批量转换

在做三维场景的时候,经常会涉及多种不同格式DEM数据或者影像的转换,如ASCII、GRID、IMG、TIFF等等,遇到大数据量时,我们就需要批量转换功能了。

下面使用python脚本来实现批量转换,把f:\\test文件夹下的*.grd栅格文件转换为*.TIFF文件并存于其下的TIFF子文件夹中:

[python]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. # Import system modules  
  2. import sys, string, os  
  3.   
  4. dir = 'F:\\test'  
  5.   
  6. # Import arcpy module  
  7. import arcpy  
  8.   
  9. files = os.listdir(dir)  
  10. for f in files:  
  11.     if os.path.splitext(f)[1] == '.grd':  
  12.         # Script arguments...  
  13.         Input_raster_file = dir + os.sep + f  
  14.   
  15.         # Local variables...  
  16.         Output_data_type = "FLOAT"  
  17.         Raster_Format = "TIFF"  
  18.         Output_Workspace = "f:\\test\\TIFF"  
  19.   
  20.         # =============== file name process ======================  
  21.         basename = os.path.splitext(f)[0];  
  22.         Output_raster = Output_Workspace + os.sep + basename + ".tif";  
  23.   
  24.         if os.path.exists(Output_raster) == False:  
  25.             print Input_raster_file  
  26.             # Process: Raster To Other Format (multiple)...  
  27.             arcpy.RasterToOtherFormat_conversion(Input_raster_file,   
  28.                         Output_Workspace, Raster_Format)  
  29.   
  30.             print Output_raster  
注:当然此方法也适用于各类影像数据格式的转换。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值