Format for ImageServer input parameter in arcpy MakeImageServerLayer_management

1026
2
Jump to solution
06-30-2017 10:16 AM
AnthonyPreston1
New Contributor

Regarding Make Image Server Layer—Data Management toolbox | ArcGIS Desktop 

When attempting to use a URL as the input parameter, as shown in the documentation, it results in a "000999: Failed to get raster" error. 

Extent = "-13072350.2812 4050838.0059 -12990486.2246 4075450.729"
Input_ImageServer = "http://servername.gov/arcgis/rest/services/folder/RasterName_1/ImageServer"
ImageServer_OutLayer = "Output_Layer"

arcpy.MakeImageServerLayer_management(Input_ImageServer, ImageServer_OutLayer, Extent, "", "Center", "", "0", "", "30")

However, if I use a GIS server connection from ArcCatalog (to the exact same image service), it works.

Extent = "-13072350.2812 4050838.0059 -12990486.2246 4075450.729"
Input_ImageServer = "GIS Servers\\connection name\\folder\\RasterName_1.ImageServer"
ImageServer_OutLayer = "Output_Layer"

arcpy.MakeImageServerLayer_management(Input_ImageServer, ImageServer_OutLayer, Extent, "", "Center", "", "0", "", "30")

I'd like to be able to use this as advertised with a URL, to avoid needing a pre-defined connection property. Adding a port number as shown in the documentation didn't appear to make a difference. Has anyone made this work? Perhaps I'm missing a step or parameter that needs to be set when the image service is published?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
IanMurray
Frequent Contributor

I think you need to drop the /rest/ portion of the path to the server.

I have a script tool that uses MakeImageLayer and here is the location of the image service I access.  Similar to the example in the help.

http://kyraster.ky.gov/arcgis/services/ElevationServices/Ky_DEM_KYAPED_5FT/ImageServer

View solution in original post

2 Replies
IanMurray
Frequent Contributor

I think you need to drop the /rest/ portion of the path to the server.

I have a script tool that uses MakeImageLayer and here is the location of the image service I access.  Similar to the example in the help.

http://kyraster.ky.gov/arcgis/services/ElevationServices/Ky_DEM_KYAPED_5FT/ImageServer

AnthonyPreston1
New Contributor

This did fix it, thanks. I must have missed the omission of the /rest/ from the sample URL in the doc.

0 Kudos