How would one go about exporting a Mosaic dataset from a enterprise geodatabase to a file geodatabase using ArcPy?
I'm able to copy a mosaic dataset via the ArcCatalog GUI by doing a copy/paste from one geodatabase to another, but I was hoping I could automate this with ArcPy.
I tried using the copy tool to do this but I can't seem to copy into an existing geodatabase:
import arcpy arcpy.env.workspace = "<path to sde file>" dest_gdb = "<path to new file gdb>" + "test.gdb" arcpy.CreateFileGDB_management("<path to file new file gdb>", "test.gdb") mds_list = arcpy.ListDatasets("*", "Mosaic") for ds in mds_list: arcpy.Copy_management(ds, dest_gdb)
The above snippet errors out with:
Traceback (most recent call last): File "migrate.py", line 85, in (module) arcpy.Copy_management(ds, dest_gdb) File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py" line 3838, in Copy raise e arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000725: Output data element: Dataset <path to file gdb>\test.gdb already exists. Failed to execute (Copy).
I was also thinking of using the create mosaic dataset function and then inserting the individual rasters from the source dataset into the new mosaic dataset, but I couldn't find any functions to list the rasters of a mosaic dataset.