Web Tools with Mosaic Datasets

275
0
06-04-2023 12:38 AM
MoritzHackenberg
New Contributor II

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.

 

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")

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.

 

Tags (2)
0 Kudos
0 Replies