Select to view content in your preferred language

arcgis.raster.analytics delete_image always fails

79
0
Friday
Labels (2)
nworbi
by
Emerging Contributor

Hi Community

In ArcGIS Online, I have a hosted dynamic image collection created using arcgis.raster.analytics.create_image_collection.

I want to update the image collection by adding and deleting images. I can add images fine, but the delete always fails.

Why is this happening?

from arcgis.raster.analytics import add_image, delete_image, build_footprints, build_overview
gis = GIS(username=username, password=password, trust_env=True)
imgLyr = gis.content.get('item ID')

# add new image from local path --> this works as expected
add_image(image_collection = imgLyr,
                             input_rasters = [new_image_local_path],
                             raster_type_name = "Raster Dataset")

# delete_image based on condition --> always fails even with valid condition
delete_image(image_collection=imgLyr, where="OBJECTID=7")

 

 task logs and error message:

Submitted.
Executing...
Start Time: Friday, July 4, 2025 3:53:41 PM
Raster Analytics helper service: https://rasteranalysis.arcgis.com/arcgis
Running on ArcGIS Online.
name 'token' is not defined
Failed to execute (DeleteImage).
Failed.
Read Data Store info from Registry.
Hosted Imagery Privilege Check: OK
Getting image service info...
name 'token' is not defined
Failed script DeleteImage...
Failed to execute (DeleteImage).
Failed at Friday, July 4, 2025 3:53:46 PM (Elapsed Time: 4.13 seconds)
Failed.
DeleteImage GP Job: 24e3d96dee884d22b6e5aaba08b7691c failed: Job failed.
0 Replies