generate_raster in raster analytics

802
1
01-24-2017 10:37 AM
springzhang
New Contributor II

I explored the function generate_raster in ArcGIS python API, following the tutorial creating raster information product using raster analytics | ArcGIS for Developers.

It worked perfectly when using the built-in raster functions like 'Stretch' as demoed in the tutorial. But when I replace the rasterFunction name with the one in my image service, like, 'customRasterFunction', it returned the error below.

ERROR 001641: The specified entry 'Input Raster Function' is invalid. A processing template must reference either a valid raster function template (RFT) XML file or a pre-existing template by name.\nFailed to execute (GenerateRasterFromRasterFunction).\n."}

It seems that it could not find the raster function template 'customRasterFunction'. However, when I opened the image service in map viewer, and click 'Image Display', I can change the Renderer to the 'customRasterFunction', and the image is displayed without any problem. 

Any idea why?

0 Kudos
1 Reply
JieZhang
Esri Contributor

Hi spring,

If you want to use the raster function name as the input to the raster function parameter for the Generate Raster service, it has to be a system build-in raster function. It does not support the custom processing template name keyword you published with your input image service.

If you want to use a custom raster function template, you should write the full raster function implementation in JSON as the input for the raster function parameter.

The raster function JSON object is defined in our REST API. ArcGIS REST API 

For example:

{  "rasterFunction" : "Stretch",  "rasterFunctionArguments" : {    "StretchType" : 6,    "MinPercent" : 0.25,    "MaxPercent" : 0.25,    "Gamma" : [1.25, 1.25, 1.25],    "DRA":true,    "Min":100,    "Max":255,  },  "outputPixelType":"U8",  "variableName" : "Raster"}

I need to clarify the image display option you saw in the webmap on a image layer is only for rendering of that specific image layer. For generate raster service request, it may accept more than one image layer inputs, the raster function parameter setting is for you to define additional analysis on top of each input image layer. Hence you cannot just use the function name there.

0 Kudos