2

Tipically, ESRI GRIDS are not defined by a file extension like for the .tif files, but they are stored in a info folder plus an extra folder corresponding to the name of the raster. Arcpy allows to return a list with the ListRasters function. What is the best way to do it in a python script?

3

If you work with ArcGIS 10.1 SP1 or above, you can use the arcpy.da.Walk() function to list Esri or other GIS data formats recursively. Use the type parameter to restrict the search to Esri GRID files:

import arcpy, os
workspace = r"C:\directory"
output_folder = r"C:\other_directory"
walk = arcpy.da.Walk(workspace, type="GRID")

for dirpath, dirnames, filenames in walk:
    for filename in filenames:
        print filename
        arcpy.RasterToOtherFormat_conversion(os.path.join(dirpath, filename), output_folder, "TIFF")
1
  • Thanks. Actually, the idea was to do it without the arcpy package. Sorry for not specifying it. Jan 30 '15 at 15:50
0

You might have to dig into that extra folder after listing all of the info folders using python.

Use the os module to list all of the info folders, then for each folder look for an extra folder. Inside that extra folder, look for one of the extentions that are stored with a GRID file (like .adr)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.