Skip to content

Instantly share code, notes, and snippets.

@GISmd
Created March 27, 2017 20:56
Show Gist options
  • Save GISmd/04b72f4adc91737d4a55606d3f69b634 to your computer and use it in GitHub Desktop.
Save GISmd/04b72f4adc91737d4a55606d3f69b634 to your computer and use it in GitHub Desktop.
def addraster_list_to_mosaicdataset(rasterlist, mosaic_dataset_path):
"""Use this function to add a list of rasters to a mosaic dataset
Parameters:
rasterlist : list
List containing the paths to the rasters to be added to the mosaic
dataset
mosaic_dataset_path : str
String of the path to the mosaic dataset to which the rasters
will be added
"""
length = len(rasterlist)
for i, raster in enumerate(rasterlist):
print 'Processing raster {} of {}'.format(str(i+1), str(length))
arcpy.AddRastersToMosaicDataset_management(mosaic_dataset_path, input_path=raster)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment