Skip to content
Feroz Abdul-Kadar edited this page Sep 23, 2014 · 44 revisions

ArcGIS Raster Functions

Raster function are operations that can be used to process pixels on-the fly. They can be applied to rasters, mosaic datasets or items in a mosaic dataset. Because functions are applied on top of datasets they do not change the original data. This allows for fast processing and rendering of pixels. Functions can be applied to rasters using several methods. If you are applying a function to a raster dataset it be done using the function button in the image analysis window For more information on adding functions to raster datasets take a look at the following link. Adding functions to mosaic datasets or items in a mosaic dataset can be done through their respective property windows. For more information on adding functions to mosaic datasets, take a look at the following link. Functions can also be used with image services. They can be published with the image service directly or in a template that can be applied by by the client.

ArcGIS comes with several out of the box functions that can be used to apply radiometric and geometric processes to rasters. The list of functions available in ArcGIS can be found [here] (http://resources.arcgis.com/en/help/main/10.2/index.html#//009t00000044000000). These functions can be applied individually or combined to create more complex function chains.

The Python Raster Function

With ArcGIS it is also possible to create custom functions. This can be done using the Python Raster function. The Python Raster Function allows users to write image processing algorithms in Python and apply them to mosaic datasets and raster datasets. The Python adapter function can be inserted into a function chain just like any other function. It accepts one of two inputs; a .py file or a .pyd (complied Cython) file. The parameters for the function are controlled within the Python script, therefore end users can simply point to a script and the function interface will be populated.

Using the Python Raster Function

The Python raster function can be inserted into a function chain by right clicking on an existing function or raster in the function dialog. Unlike the out of the box functions, it is located in the first dialog after right clicking on an existing function. The Python Raster Function dialog has three components; the input Python module, the class name and the input parameters.

Python Raster Function: Property Page

The input Python module parameter will accept a Python script (.py) or a Cython file (.pyd). These files must adhere to the structure of the Python raster function. After pointing to a Python file the rest of the dialog will be populated.

The class name parameter will contain the name of the class being used from the python script. In most cases a Python script will contain one class. It is possible to have multiple classes in one Python script. At this point the end user can type in which class they would like to use. By default the first class in the script will be used.

The parameters window contains the parameters that are defined by the Python script. The values of the parameters can be set by the end user. There are 5 possible data types that can be used as parameters; numeric, string, raster, rasters and boolean. Domains can be created for parameters in order to limit the list of input values that a user can chose from. In this case when clicking on the value a drop down menu will appear. For more information on the method that controls input parameters go to the .getParameterInfo() section of the help document.

If the parameter type is set to 'rasters' a user can click on the value section of the parameter and a second window will open. This window allows you to add rasters from multiple sources. The following options are available when adding rasters from this dialog.

  • Add raster from disk: Add a raster that is on disk. You can add raster datasets, mosaic datasets, and raster products.
  • Add function chain: Add a function chain as an input.
  • Add scalar: Add a scalar value. Scalar values must be numeric.
  • Add reference to selected input: Add a referenced copy of the selected raster or the selected function chain input. A change in the referenced raster or the function chain will be reflected in this referenced copy. This can be useful when creating many Local functions that may use the same referenced input.
  • Add copy of selected input: Add a static copy of the selected function chain input. A change in the copied function chain will not reflect this static copy. This can be useful when creating many similar Local functions where there is a slight change in the function chains.