top of page

Raster to Geodatabase​​

The Python script copies all the rasters in a workspace to a new file geodatabase.

# Ehsan Momeni

# Raster processing

from arcpy import env, ListRasters, Exists, CreateFileGDB_management, RasterToGeodatabase_conversion  # required madules

Input_folder = r"C:\Users\emomeni\data\\" # input data path


env.workspace = Input_folder  # Shapefile sources
env.overwrite = True

GDB_name = "GDB.gdb" # the name of new geodatabase

# Execute CreateFileGDB
if not Exists(GDB_name):
    CreateFileGDB_management(Input_folder, GDB_name)

rasterlist = ListRasters()  # listing all rasters in the input folder


print("There are %d rasters in the folder:\n" % len(rasterlist))


for raster in rasterlist:
    RasterToGeodatabase_conversion(raster, GDB_name)  # converting raster to geodatabase

 

google_scholar1-300x150.png
ResearchGate.png
Ehsan Momeni ORCID GIS Remote Sensing Ur
Ehsan Momeni LinkedIn GIS Remote Sensing
ncbi-300x150.png
academia.png

(Information on this website may not be up to date)

bottom of page