Skip To Content

Server-side processing with raster functions

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.

  1. In ArcMap, click the Customize menu and click Customize Mode.
  2. Click the Commands tab.
  3. In the Categories list, scroll down and click Raster.
  4. From the Commands list, drag and drop the Raster Function Template Editor Raster Function Template Editor item onto any toolbar.
  5. Click Close.
    Tip:

    To remove the button from the toolbar, open the Customize dialog box, click the Raster Function Template Editor button Raster Function Template Editor, drag and drop it off the toolbar, then close the Customize dialog box.

  6. Click the Raster Function Template Editor button Raster Function Template Editor 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.

  1. Click the Raster Function Template Editor button Raster Function Template Editor. 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.

  2. Right-click Function Chain Function Chain and click Properties.
  3. 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

  4. Enter a default number of bands in the Value column and click OK.
  5. Right-click the Identity Function or the Raster item in the chain, click Insert, then select a function from the list.
    Inserting a function

    The function is added above where you right-clicked.

    You can double-click the function to reopen it to modify its properties.

  6. Continue inserting functions to build the function chains you require.
  7. 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.

  8. 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.
    Example function chain
  • 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.

  1. If the image service is published and running, stop it.
  2. Access the image service properties.
  3. From the left menu of the Service Editor dialog box, click Function.
  4. Click the Manage button to open the Manage Raster Function Templates dialog box.
  5. Add one or more .rft.xml files to the list.
  6. Optionally, choose a raster function template to apply by default by selecting it in the Default drop-down menu.
  7. Click OK to close the dialog boxes.
  8. Publish the image service.