Select to view content in your preferred language

How can we mosaic multiple raster images from separate folders?

2478
3
06-01-2017 04:39 AM
NilakshiChatterji
Deactivated User

I have 380 DEMs. All the rasters are in .tif format. I am trying to mosaic them together. But the issue is that every raster image is in a separate folder. There are 380 folders for the 380 different rasters. I have tried creating a file geodatabase, adding a raster catalog and then adding the DEMs to the catalog. But it did not work.

I have also tried creating an empty mosaic dataset and adding rasters to it.

The issue basically is that every raster is in a separate folder and mosaicking them individually is not a feasible option.

Kindly suggest a solution!

dem mosaic‌ raster mosaic dataset

0 Kudos
3 Replies
Asrujit_SenGupta
MVP Regular Contributor

arcgis desktop - How to use ModelBuilder to add many images to mosaic dataset? - Geographic Informat... 

Creating a mosaic dataset—Help | ArcGIS for Desktop 

  • The Include Sub Folders check box should be checked. This option will recursively explore any subfolders containing the data being added.
NilakshiChatterji
Deactivated User

Thank you for your reply.

But we had already checked the sub-folder option while adding rasters to the mosaic dataset. Just for your convenience the folder structure that we have right now is:

  1. Main Folder 1
    • Sub-folder 1
      • Raster
    • Sub-folder 2
      • Raster
    • .....
  2. Main Folder 2
    • Sub-folder 1
      • Raster
    • Sub-folder 2
      • Raster
    • ......

Like this we have four main folders and approximately 50-60 sub-folders within each main folder and every sub-folder has one raster each. So how do we iterate between these folders?

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Have you tried Adding raster data to a mosaic dataset—Help | ArcGIS for Desktop    with the "Workspace" option?

I tried it three different ways (with 3-main, 2ith 2 subfolders unders each, with on raster.

  1. adding all the sub-folder x (i,.e 6 folders),
  2. adding all the Main folders (i.e. 3)
  3. adding a top folder with the structure you have.

All three of these had the same result, so I think if all your "Main Folder X" folders are in a separate "top folder" you should be able to run this command once.  I've done a similar process with about 56k raster,

Copy of the python snippet.......most are the default options....I only entered the info in the above window.

arcpy.AddRastersToMosaicDataset_management(in_mosaic_dataset="C:/__temp/_test.gdb/test3", raster_type="Raster Dataset", input_path="C:\__teemp", update_cellsize_ranges="UPDATE_CELL_SIZES", update_boundary="UPDATE_BOUNDARY", update_overviews="NO_OVERVIEWS", maximum_pyramid_levels="", maximum_cell_size="0", minimum_dimension="1500", spatial_reference="", filter="#", sub_folder="SUBFOLDERS", duplicate_items_action="ALLOW_DUPLICATES", build_pyramids="NO_PYRAMIDS", calculate_statistics="NO_STATISTICS", build_thumbnails="NO_THUMBNAILS", operation_description="#", force_spatial_reference="NO_FORCE_SPATIAL_REFERENCE")