A raster function template contains a chain of functions and inputs as values or variables. The function template can then be added to a mosaic dataset, a mosaic dataset item, or a function raster layer to process pixels on-the-fly.
A function template not only contains raster functions, it also contains properties of the template:
- Name—The template name.
- Description—The description of the template.
- Help—The help content that you want users to see when using this template.
- Type—Indicates the template applied to a mosaic dataset, mosaic dataset items, or item groups specified in the Definition Query.
- Group field name—The field name in the mosaic dataset that defines a group.
- Tag field name—The field name in the mosaic dataset that contains the variable names used in the raster functions.
The Type property groups together items with the same GroupName and TagName. These two tags are normally used in (but not limited to) multidimensional mosaic datasets, where rasters with the same dimension values are considered one group, and tag names are normally the variable names used in the computation. For example, apply a function named P with a formula of V1 x V2 to each group in the mosaic dataset. Below is a list of function template properties:
- Name—P
- ...—Intermediate fields not shown here
- Type—Item Group
- Group field name—Group
- Tag field name—Tag
Table showing the Group and Tag fields
Raster | ... | Group | Tag | Time |
---|---|---|---|---|
Name1 | a | v1 | t1 | |
Name2 | a | v2 | t1 | |
Name3 | b | v1 | t2 | |
Name4 | b | v2 | t2 |
This produces new items for each group, as shown below.
Table showing the new items produced
Raster | ... | Group | Tag | Time |
---|---|---|---|---|
NewName1 | a | P | t1 | |
NewName2 | b | P | t2 |
- It can be loaded into a processing template when you add data to a mosaic dataset. Open the raster type properties, click the Functions tab, right-click a processing template, and click Load.
- It can be used to edit the function chain in a mosaic dataset or its items using the Edit Raster Function tool or the Raster Function Editor Wizard.
- It can be used to set the properties of the mosaic dataset when using Set Mosaic Dataset Properties or Set Raster Properties. These processing templates will be used to respond to requests from the processing template tab from the layer.
Saving a function chain as a raster function template
There are several locations where you have access to a function chain, such as:
- On the Function tab on the Layer Properties dialog box.
- On the Raster Function Editor opened from the Image Analysis window.
- On the mosaic dataset.
- On each raster within the mosaic dataset.
In all these locations (except on the mosaic dataset), you can export the function chain to a template.
- Access a function chain.
- Right-click the first item () under the Function Chain and click Export As Template.
The function chain opens in the Raster Function Template Editor.
- This template must be edited so you can apply it using other raster data, because in its current state, it is set up to work with the data in the function chain from which it was exported. For example, you need to set or clear some variables, such as the input raster datasets.
- Right-click the function pointing to a raster dataset and click Properties.
- Click the Variable Manager tab, right-click the Raster variable row, and click Clear default value of Raster.
The TIFF file originally pointed to by this function is cleared.
- Save it or enter a variable name that applies to the data with which this template is used.
For example, if you plan to use this template with a raster type, such as IKONOS, you can open the IKONOS raster type properties to see the variable names it uses and use them, such as MS, Dataset, or Pan.
If you plan to use this template with the Raster Dataset raster type, the raster dataset variable name is Dataset.
The variables that can be used include:
- Dataset
- Pan (short for pan-sharpened)
- MS (short for multispectral)
- Thermal
- DEM
- Pan-sharpened
If you plan to use this template with the Table raster type and an associate table, where the table contains the file name and path to each raster dataset, you can enter @field.<field name> as the Variable Name.
If this raster function template publishes with an image service with the purpose of using the image service as the input data, the raster Variable Name must be Raster. For some functions, such as Slope or Hillshade, the default is DEM. You must change the Variable Name from DEM to Raster.
- You can also make changes to the other variables, such as setting a gamma value or pointing to a table field to define the value in the Stretch function. You can also modify these values on the Stretch tab so the same value is defined for every raster dataset.
- Click OK on the Raster Function Properties dialog box to save the changes to the variables.
- At the top of the chain, right-click Function Chain and click Set Help Info to add some useful information to this function chain to help you or others use it.
Close the Function Template Help dialog box when finished.
- Click File > Save to save the raster function template.
Creating a new raster function template
- 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.
Editing a raster function template
If you have an existing raster function template (*.rft.xml) file, you can open it in the Raster Function Template Editor and make modifications.
- Click the Raster Function Template Editor button (added to a toolbar from the Customize dialog box).
This opens a dialog box with a default function chain.
- Click File > Open, navigate to and select a raster function template (*.rft.xml) file, then click Open.
- Make the modifications.
- Click File > Save.
Related Topics
- Rasters with functions
- What are the functions used by a raster or mosaic dataset?
- Editing function chains in a mosaic dataset
- Editing functions on a raster dataset
- Edit Raster Function
- Applying a function template
- Populating functions with values from the attribute table
- Accessing the Raster Function Template Editor
- Saving a raster function template from the layer's symbology
- Adding a processing template to a mosaic dataset
- Adding raster data to a mosaic dataset using a custom template
- Server-side processing with raster functions