2

Is it possible to create and edit mosaic datasets via web tools / geoprocessing services?

I managed to publish and run a script tool performing an intersect with two shape files.

import arcpy
a = arcpy.GetParameterAsText(0)
b = arcpy.GetParameterAsText(1)

arcpy.analysis.Intersect([a, b], f"{arcpy.env.scratchGDB}\\intersected", "ALL")
arcpy.SetParameter(2, f"{arcpy.env.scratchGDB}\\intersected")

When I try it with the project home GDB path in the registered folder instead of the scratchGDB, I get an empty feature class and map layer. The two input parameters of the script tool are of type shapefile. I kept "add optional output feature service parameter" checked for the derived output parameter whilst publishing, so the output lands in a feature service and the map.

enter image description here

When I try to do something similar for creating a mosaic dataset, I get either broken project datasource or no error and no output. For example when writing the MD to the scratch GDB:

ERROR 000732: Mosaic Dataset: Dataset C:\Users\HACKEN~1\AppData\Local\Temp\37\ArcGISProTemp74484\scratch.gdb\S_col does not exist or is not supported
Failed to execute (MakeMosaicLayer).

I have tried it with the Model Builder, scripts and MDCS. I have tried using an existing Mosaic Layer. arcpy.management.MakeMosaicLayer() does not recognize the Mosaic dataset in the input. Do I have to work with image services on the image server for intermediate results?

import arcpy
arcpy.CreateMosaicDataset_management(arcpy.env.scratchGDB, "mosaic_dataset","25832", "1","8_BIT_UNSIGNED", "NONE")
#arcpy.management.MakeMosaicLayer(f"{arcpy.env.scratchGDB}\\S_col", "md_lyr")
arcpy.management.AddRastersToMosaicDataset(f"{arcpy.env.scratchGDB}\\mosaic_dataset", "Raster Dataset",
                                           r"D:\FileShare_AGE\2022-11-24", "#", "#",
                                           "#", "2", "#", "#", "#", "*col.tif", "SUBFOLDERS", "EXCLUDE_DUPLICATES")
arcpy.SetParameter(0, f"{arcpy.env.scratchGDB}\\S_col")

enter image description here

I have tried with datatypes mosaic layer, mosaic dataset, image service and feature class for the output parameter, as well as home gdb instead of scratch gdb.

9
  • Wait. You're using the scratch geodatabase that gets created anew for each service to store the mosaic dataset? Do you see why that can't possibly work? You need a permanent registered location that doesn't get deleted 5 minutes after the previous run to store the dataset.
    – Vince
    Commented May 29, 2023 at 11:27
  • unfortunately, it does not work with the mosaic dataset in a normal geodatabase either. Commented May 30, 2023 at 7:10
  • Then Edit the Question to document your process with a valid mosaic dataset. And add an ArcPy.AddMessage with the parameter value to the script and report the output.
    – Vince
    Commented May 30, 2023 at 11:35
  • Why do you want to make a Mosaic Dataset using a GP Service. What is your USER workflow that requires this?
    – KHibma
    Commented Jun 1, 2023 at 14:03
  • This is actually just a test. In the end, we want to run a script with GP commands that calls MDCS several times. When I ran that, I got "broken data source \Footprints" So I tried to narrow it down to createMosaicDataset(), without success so far. Commented Jun 1, 2023 at 14:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.