I would like to change the default mosaic operator on mosaic datasets my script creates. However, I can only manually change the mosaic operator from mosaic dataset properties from ArcCatalog by right clicking the mosaic dataset. Is there a way this could be access and changed from the script itself?

This is the properties window that I am trying to access using arcpy: enter image description here

I'm trying to accomplish something similar to this:

for mosaic_dataset in mosaic_datasets:
    arcpy.CreateMosaicDataset_management(gdb_path, mosaic_dataset, coord, "1","8_BIT_UNSIGNED")

which works fine, but the next step is to change the mosaic operator from python rather than manually changing it and I cannot find any documentation.

  • I've added the code, but there is no documentation on how to access mosaic dataset properties from python, so I have no idea how to code next step. – cptpython Jan 24 '17 at 19:48
  • 1
    According to geonet.esri.com/thread/84146#comment-354355 there is no way to access the properties through python, you need to use arcobjects – Midavalo Jan 24 '17 at 19:54
  • You may need to consider looking for or submitting an ArcGIS Idea. – PolyGeo Jan 24 '17 at 19:58
  • I found a workaround for this problem but this is good to know. Ty. – cptpython Jan 24 '17 at 20:28
  • @cptpython there's a standard arcpy tool to do this. See my answer. – user2856 Jan 25 '17 at 5:15

Use the Set Mosaic Dataset Properties tool.

arcpy.SetMosaicDatasetProperties_management(mosaic, default_mosaic_method='First')

You can set more than one property at a time:

  • Wonderful! Shame on me for not digging hard enough. – cptpython Jan 25 '17 at 16:31

My workaround for this problem was to create an empty mosaic dataset, make the desired changes and then place it in a loop using arcpy.Copy_management to create multiple copies. It is not ideal, but gets the job done with minimal reworking of workflow:

for mosaic_dataset in mosaic_datasets:
    mosaic_data_template = "C:/MD.gdb/template"     
    arcpy.Copy_management(mosaic_data_template, mosaic_dataset)

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.