Error while running clip tool with Secured Image service as input in python (arcgis-py3)

627
1
07-23-2019 02:21 PM
PrasanthRamachandran2
New Contributor II

I am writing a python script to do a raster analysis on our assets with fire layer from living atlas with arcgis-py3 python models. As pat of this script, I have to run a clip tool to clip the raster  from Image service with area of interest layer and save the image (tif) file locally. Below is the code I wrote to clip the raster.

When I run the code, I am receiving "Authentication token required" error message. I tried to rewrite the code to pass in the portal item but I am still getting the same error message.

If anyone has any idea or work around to fix the issue then please let me know. Thank you!!

Code :

arcpy.Clip_management(in_raster="https://landscape10.arcgis.com/arcgis/rest/services/USA_Wildland_Fire_Potential/ImageServer",
rectangle="-104.304669288 30.303921921 -94.3521542569999 35.3735805700001",
out_raster=Clipped_Fire_Potential_Raster, in_template_dataset=Dissolved_Transmission_Lines,
nodata_value="0", clipping_geometry="NONE", maintain_clipping_extent="NO_MAINTAIN_EXTENT")

Error Message :

Authentication Token Required Error Message

0 Kudos
1 Reply
VHolubec
Esri Regular Contributor

Hello,

just in case you would need to return to your code - I think, you must use Make Image Server Layer tool (https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-image-server-layer.htm) at first and then use the temporary layer in the analysis.

Vladimir
0 Kudos