1

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.

  • Welcome to GIS SE! As a new user please take the tour to learn about our focused Q&A format. Please edit your question to include the entire error message including any line numbers, and also the definition of dest_gdb as it doesn't appear to be defined in your code snippet. – Midavalo May 12 '17 at 15:02
1

There is a Moving or copying a mosaic dataset page in the Help that specifically talks about moving/copying mosaic datasets.

Also you appear to have invalid file paths, "<path to new file gdb>" is not a valid path. If you are trying to hide the actual path, this is not very helpful as the error could be caused by the very thing you are deliberately obscuring, self defeating...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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