0

I'm trying to design a program to help me convert 1000+ DEM file into USGS raster file, using the method "arcpy.DEMtoRaster_Conversion" in ArcGIS. My idea is to use a OpenFileDialog to allow multiple selection for these files, then use an array to same these names and use these names as the inDEM and save the outRaster in tif format.

file_path = tkFileDialog.askopenfilename(filetypes=(("DEM", "*.dem"),),multiple=1)

this is how I open multiple files in the dialog, but I;m not sure how to save them so as to fulfill the following steps. Can someone help me?

Arthur
  • 179
  • 2
  • 9

1 Answers1

0

This code will find all dems in a folder and apply the conversion function and save the output tiffs to another folder

#START USER INPUT
datadir="Y:/input_rasters/" #directory where dem files are located
outputdir="Y:/output_rasters/" #existing directory where output tifs are to be saved in
#END USER INPUT
import os
arcpy.env.overwriteOutput = True
arcpy.env.workspace = datadir
arcpy.env.compression = "LZW"

DEMList = arcpy.ListFiles("*.dem")
for f in DEMList:
    print "starting %s" %(f)
    rastername=os.path.join(datadir, f)
    outrastername=os.path.join(outputdir, f[:-4]+".tif")
    arcpy.DEMToRaster_conversion(rastername, outrastername)
Lucas Fortini
  • 2,420
  • 15
  • 26