I am using python to try and iterate through a feature class to use the extent of each feature to update the extent in the Clip Raster tool. This is to get around the row/column limitation Esri places on its image servers. I have included the code below. It runs successfully but the raster values range from 0 to 0. I have tried it directly on the Image Server, and on my own image server layer made from the wider image layers, as shown below. The script works fine on a DTM layer downloaded and saved to my local drive. Additionally, running it as a standalone geoprocessing tool, with the image_server_layer as input, and one feature selected and set as the extent, provides the desired outcome!
raster = r'https://uk-gis.stantec.com/portal/sharing/servers/af25a795273440deb449b336543602be/services/WorldElevation/Terrain/ImageServer'
with arcpy.da.SearchCursor(sites, fields) as cursor:
for row in cursor:
extent = row[1].extent
# Create the image server layer
image_server_layer = arcpy.management.MakeImageServerLayer(raster, 'ImageSL', extent)
# Define the output raster path
output_raster = out_loc + '\\' + row[0] + "_2025"
# Ensure the extent values are correctly formatted
rectangle = f"{extent.XMin} {extent.YMin} {extent.XMax} {extent.YMax}"
# Clip the raster based on the extent
arcpy.management.Clip(in_raster=image_server_layer, rectangle=rectangle,
out_raster=output_raster, in_template_dataset="",
nodata_value="255", clipping_geometry="NONE", maintain_clipping_extent="NO_MAINTAIN_EXTENT")
print(f"Exported and clipped raster part for feature {row[0]}")