您的位置:首页 > 其它

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

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

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

[python] view
plain copy

 





# Import system modules  

import sys, string, os  

  

dir = 'F:\\test'  

  

# Import arcpy module  

import arcpy  

  

files = os.listdir(dir)  

for f in files:  

    if os.path.splitext(f)[1] == '.grd':  

        # Script arguments...  

        Input_raster_file = dir + os.sep + f  

  

        # Local variables...  

        Output_data_type = "FLOAT"  

        Raster_Format = "TIFF"  

        Output_Workspace = "f:\\test\\TIFF"  

  

        # =============== file name process ======================  

        basename = os.path.splitext(f)[0];  

        Output_raster = Output_Workspace + os.sep + basename + ".tif";  

  

        if os.path.exists(Output_raster) == False:  

            print Input_raster_file  

            # Process: Raster To Other Format (multiple)...  

            arcpy.RasterToOtherFormat_conversion(Input_raster_file,   

                        Output_Workspace, Raster_Format)  

  

            print Output_raster  

注:当然此方法也适用于各类影像数据格式的转换。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: