Here is a simple script that places rasters into a catalog then mosaics them. I can't help but feel I am doing this in a less than optimal manner. So, I am wondering if there is a faster way to run this or if I should just be patient with current speeds? Thanks for any help and suggestions!
from arcpy import env
ws = r"C:/test"
rc = r"C:/H/H.gdb/DEM_Tiles"
for dirpath, dirnames, filenames in arcpy.da.Walk(ws, datatype="RasterDataset", type="ALL"):
for filename in filenames:
addRaster = arcpy.WorkspaceToRasterCatalog_management(ws, rc, "INCLUDE_SUBDIRECTORIES", "NONE")
print "adding:", filename
print "Workspace to raster catalog failed"
print "Setting up mosaic for tiles..."
arcpy.RasterCatalogToRasterDataset_management(r"C:H.gdb/DEM_Tiles", r"C:/H.gdb/Mosaic", "", "FIRST", "FIRST", "", "", "8_BIT_UNSIGNED", "NONE", "NONE", "", "")
print "raster mosaic failed"
Solved! Go to Solution.
Did you create a managed raster catalog, or an unmanaged raster catalog? A managed raster catalog will copy the rasters into the geodatabase, while an unmanaged raster catalog will simply reference the path of the rasters on disk.
I wouldn't recommend using a raster catalog at all, though. I would recommend creating a mosaic dataset. The performance is very fast, and I doubt you'll have the need to export the mosaic dataset to a raster dataset.
Jake: Thank you for the response. I saw the mosaic dataset option but was unsure of my ability to use a clip function with it. Will I still be able to clip boundaries out of a mosaic dataset? I'll have to run this and give it a shot.