Server-side processing with raster functions
In this topic
- Accessing the Raster Function Template Editor
- Creating the raster function template
- Configuring an image service to use a raster function template
Image services support server-side processing through some default functions that are supported through REST, but also by publishing image services and associated raster function templates that can be accessed and used via REST and ArcGIS for Desktop applications, such as ArcMap.
To implement the raster function template (.rft.xml), you must first create it using the Raster Function Template Editor, then add the .rft.xml file to the image service when it is published. When publishing the .rft.xml file with an image service, the functions defined within a raster function template can be applied only to the contents within an image service. The template cannot use data from another input.
Using REST to perform server-side processing on image services is very useful when creating web applications that offer image services processed using different methods, or when applications cannot perform the processing. For example:
- If the image service contains imagery, such as Landsat, a web application can be created to perform an NDVI using the red and near-infrared bands.
- If the image service is a DEM, a web application can be created to allow the user to view the image service as a hillshade, slope, or shaded relief image.
REST supports basic functions on image services, including aspect, color map, NDVI, slope, shaded relief, hillshade, statistics, and stretch. But you can extend these capabilities by publishing an image service with an .rft.xml file where you can chain the raster functions together to create the processing result you need.
Applying raster function templates to an image service containing functions, such as stretch, is useful when the image services will be used in web applications. Web applications are often unable to enhance imagery; therefore, they rely on server-side processing. In this situation, when you add a raster function template to the image service, you can choose to apply it by default.
Tip:
You can add your image to ArcMap, modify it's symbology (including the stretch) and export the settings to a raster function template. To learn about this, see Saving a raster function template from the layer's symbology.
Accessing the Raster Function Template Editor
The Raster Function Template Editor button is added from the Customize dialog box.
- In ArcMap, click the Customize menu and click Customize Mode.
- Click the Commands tab.
- In the Categories list, scroll down and click Raster.
- From the Commands list, drag and drop the Raster Function Template Editor item onto any toolbar.
- Click Close.
Tip:
To remove the button from the toolbar, open the Customize dialog box, click the Raster Function Template Editor button , drag and drop it off the toolbar, then close the Customize dialog box.
- Click the Raster Function Template Editor button to open it.
Creating the raster function template
You can create a raster function template from any location where you have access to a function chain by exporting it to a template, or you can create one within the Raster Function Template Editor.
- Click the Raster Function Template Editor button . For more information, see Adding a command to a toolbar.
This opens a dialog box with a default function chain containing the Identity Function. As soon as you add a function, the default Identity Function disappears.
- Right-click Function Chain and click Properties.
- Define the function template properties by right-clicking the function chain note and clicking Properties. You can define the following properties:
Name
Description
Help
Type
Group field name
Definition query
Tag field
- Enter a default number of bands in the Value column and click OK.
- Right-click the Identity Function or the Raster item in the chain, click Insert, then select a function from the list.
The function is added above where you right-clicked.
You can double-click the function to reopen it to modify its properties.
- Continue inserting functions to build the function chains you require.
- To add information to this function chain to help you or others use it, right-click Function Chain at the top of the chain, and click Set Help Info.
Close the Function Template Help dialog box when finished.
- Click File > Save, navigate to a location to save the .rft.xml file, then click Save.
Note:
- The function chain can only be applied to the contents within an image service. It cannot use data from another input.
- The functions will be applied from bottom to top. In the example below, the Band Arithmetic Function is applied first, then the Shaded Relief Function is applied, and the Clip Function is applied last.
- The function chain will not be validated as it is when you're editing it on a raster or mosaic dataset; therefore, you may accidentally chain together functions that will not work. For example, a chain can become invalid if one function requires a different number of bands than is output by the preceding function, such as applying the Grayscale function, which outputs one band, and following it with the NDVI function, which requires two bands. Therefore, the NDVI function cannot be applied, so the function chain cannot be applied, and the output image will be invalid.
Configuring an image service to use a raster function template
You add the .rft.xml files to the image service when you configure the parameters for it before publishing.
- If the image service is published and running, stop it.
- Access the image service properties.
- From the left menu of the Service Editor dialog box, click Function.
- Click the Manage button to open the Manage Raster Function Templates dialog box.
- Add one or more .rft.xml files to the list.
- Optionally, choose a raster function template to apply by default by selecting it in the Default drop-down menu.
- Click OK to close the dialog boxes.
- Publish the image service.