I have added a text field and a date field, however I'm realising it appears that there is a separate issue with the documentation which means the existing mosaic dataset was never used.
I used publish_hosted_imagery_collection like so:
PublishImageryLayer = publish_hosted_imagery_layer(input_data=input_rasters,
output_name=output_name,
layer_configuration="IMAGE_COLLECTION",
raster_type_name="Raster Dataset",
source_mosaic_dataset=Mosaic_dataset_path,
context={"upload_properties":{"displayProgress":True}},
gis=gis)
When this publishes, I see in console comments about 'creating an empty mosaic dataset'.
Transfer input images: [REDACTED URLs]
Transfer to Hosted folder: [REDACTED]
Finished creating empty mosaic dataset.
Create empty image collection successfully.
Preparing image collection table schema.
Ingesting data to image collection.
Finished ingesting data to image collection.
Set mosaic dataset default properties.
Adding key metadata to image collection...
Getting image service info…
I noticed that the documentation (arcgis.raster.utils module | ArcGIS API for Python) has conflicting definitions, under the function it says "source_mosaic=None", but the parameters in the documentation calls it "source_mosaic_dataset". "source_mosaic_dataset" is also used in example 3 of the example notebook Create Imagery Layer with ArcGIS Online (publish_hosted_imagery_layer edition) - Overview, and it has the console output similar to above about creating an empty mosaic dataset. I think this is a mistake in the documentation. The create_image_collection function uses source_mosaic_dataset as the parameter name so potentially a typo?
So, I replaced source_mosaic_dataset with source_mosaic, which now fails more directly but in a different way with this as the error:
Failed to transfer uploaded mosaic dataset, or missing mosaic dataset workspace.
Failed to repair data paths for uploaded mosaic dataset.
Create new image collection failed.
Failed script CreateImageCollection...
Failed to execute (CreateImageCollection).
Failed at Tuesday, February 25, 2025 6:51:51 AM (Elapsed Time: 19.07 seconds)
Failed.
CreateImageCollection GP Job: [REDACTED] failed: Job failed.
create_image_collection fails for me in the same way (I understand publish_hosted_imagery_layer is calling create_image_collection under the hood)
Do you have any pointers as to what might be causing the mosaic dataset to fail the upload?