3

This question already has an answer here:

I have around 20'000+ TIFF-rasters that I need to somehow bring together into one raster. The rasters are model outputs and usually aren't big in size (<< 1 MB each). They do not overlap. The cell size for all of them is 10 m. I have written a little python script that copies the rasters, renames them and then starts the mosaic to new raster process (code snippet below).

######## 4. Umbenennen und kopieren der Outputraster, inkl. löschen der nicht mehr benötigten Verzeichnisse
arcpy.AddMessage("Umbenenn- und Kopiervorgang wird gestartet...")
for raster in listRasters:
    new_name_raster = Sammelordner + raster[-25:-17] + ".tif"
    arcpy.CopyRaster_management(raster, new_name_raster)
    arcpy.Delete_management(raster[:-17])

arcpy.AddMessage("Umbenenn- und Kopiervorgang abgeschlossen.")
kachelliste = arcpy.ListFiles("kachel*")
for item in kachelliste:
    arcpy.Delete_management(item)
arcpy.AddMessage("Leere Verzeichnisse gelöscht.")

######## 5. Mosaikieren der kopierten und umbenennten Raster:
if check_mosaic.lower() == 'true':
    arcpy.AddMessage("Mosaikiervorgang wird gestartet...")
    arcpy.env.workspace = Sammelordner
    arcpy.env.scratchworkspace = Sammelordner
    arcpy.env.overwriteOutput = True

    mosaic_candidates = arcpy.ListRasters("*.tif","TIF")
    mosaic_name = desired_outputname + ".tif"
    arcpy.MosaicToNewRaster_management(mosaic_candidates, Mosaikordner, mosaic_name,"","32_BIT_FLOAT", 10, 1, "MAXIMUM", "LAST")
else:
    arcpy.AddMessage("Mosaikiervorgang nicht durchgeführt.")

The script is now running since more than a week, the mosaic is slowly becoming larger and is about to reach it's goal size (I've tested the script with a smaller amount of rasters and then upscaled the resulting mosaic in order to estimate the goal size of the 20'000+ rasters). So the approach is working but I'd like to speed it up, since there is a chance I'll have to repeat the simulations and then create another mosaic...

The following ideas have been around:

  • Would creating a mosaic dataset or a raster catalogue be much faster? I thought they weren't the right choices for my problem... I've read this (Fast way to merge 8000 raster?) but didn't find the answers too helpful for my problem.
  • Would creating smaller mosaics (say i.e. 200 x 100 rasters) and then mosaic these togehter be much faster?
  • I have read about the use of GDAL, but have no clue about how to access it using ArcGIS (I don't have QGIS or any other opensource GIS applications available at work). Would this help?
  • Any other suggestions?

marked as duplicate by PolyGeo arcgis-desktop Jul 24 '16 at 0:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Get them into mosaic dataset. Clip it after will produce a single raster – FelixIP May 4 '16 at 7:25
  • 2
    Mosaic cost is an exercise in I/O management. Sewing bottom tile to top tile is least cost, while sewing right tile to left tile is more, and overlaying a tile into existing is most. Therefore, organize the assembly in right-to-left pairs, then pair those to full strips for each row, then pair bottom-to-top in the same way. I know I've answered this before, but can't search for it now. – Vince May 4 '16 at 10:54
  • 1
    Here it is: gis.stackexchange.com/questions/176554/… – Vince May 4 '16 at 15:13