Is there a tool in ArcGIS Pro 2.2.1 that allows me to select and copy the raw underlying rasters referenced by a Mosaic Dataset to a folder?

  • 2
    Do you mean Mosaic Dataset, Raster Catalog or Raster Dataset? they are 3 slightly different things.. but no, there is no out-of-the-box tool to copy the underlying raster in any of these 3 raster types (there is Copy Raster but I don't think that's what you want). What is it you're trying to achieve here? There may be a satisfactory way to solve this simply if we understand why and what end you're hoping to get to. – Michael Stimson Aug 1 at 1:01
  • Sorry I meant Mosaic Dataset - (now corrected). My Mosaic Dataset references underlying 'raw' rasters (tif images). When a customer wants a copy of the underlying tifs for a particular area of our othroimagery, I would like to be able to select an area of the Mosaic Dataset in ArcGIS Pro and then export the underlying raw tifs to a folder. I did write a python tool a few years ago for ArcMap that essentially did just this, but I was wondering if ArcGIS Pro already had this functionality built in? – Dion Aug 1 at 2:04
  • Correct about Copy Raster - I think it only allows for Mosaic processed imagery to be copied out or something like that. – Dion Aug 1 at 2:07
  • I'd be interested to see such a tool, it's not easy to get the full paths of the base rasters from a catalog given a screen extent; was this in arcpy or ArcObjects? Copy Raster will export the entire mosaic dataset to a single raster dataset - unless you modify your environment extent to match the view, in which case you will get a single raster of what's on the screen. – Michael Stimson Aug 1 at 2:07
  • Was in ArcPy - I'll put it up into github and post the link back here – Dion Aug 1 at 2:09
up vote 2 down vote accepted

There is no out-of-the-box solution to export a selection of rasters from a mosaic dataset.

You can use Copy Raster with your environment extent set to Same as Display to export a single raster with the extent of the current view.

It's not easy to get to the rasters in a mosaic dataset, you can open a search cursor on one:

with arcpy.da.SearchCursor(r'D:\Testing\KCat.gdb\KCat2','Name') as sCur:
     for row in sCur:
         print row[0]

But this will give you the overview tiles as well; only the raster names are stored; only the name of the raster can be accessed, not the full path, you would have to know that in advance to copy the base rasters.

Note: even calling the 'Raster' field returning raster objects you cannot access the catalogPath or path; I have even tried describing the row[0] raster object, paths are nonsensical being D:\Testing\KCat.gdb\AMD_KCat2_CAT\Raster.OBJECTID = 357 (the mosaic dataset is in D:\Testing and called KCat2).

You might possibly be able to get the information in ArcObjects, if you're that way inclined, the object is IMosaicDataset

If you already know where your mosaic dataset has its rasters stored you could use a simple script from ArcMap:

import os

FocusDataFrame      = arcpy.mapping.ListDataFrames(arcpy.mapping.MapDocument("Current"))[0]
arcpy.env.workspace = r'c:\path\to\your\rasters'
OutFolder           = r'c:\where\you\want\to\save\to'
DataFrameExtent     = FocusDataFrame.extent

for R in arcpy.ListRasters():
    Ras = arcpy.Raster(R)

    if Ras.extent.overlaps(XTnt):
        arcpy.AddMessage('Saving {}'.format(R))
        Ras.save(os.path.join(OutFolder,R))
    else:
        arcpy.AddMessage('Skipping {}'.format(R))

This gets the extent of the dataframe then iterates the rasters in the nominated folder, checking for overlap with the dataframe extent and if there is an overlap uses the save method of the Raster object to copy the tile. From here, and based on your posted code, I can see that it would be very easy for you to modify this simple process to suit your needs.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.