A curated set of lightweight but powerful tools for on-the-fly image processing and raster analysis in ArcGIS.

Esri Esri Last update: Nov 19, 2023

ArcGIS Raster Functions

This repository houses modern image processing and analytic tools called raster functions. Raster functions are lightweight and process only the pixels visible on your screen, in memory, without creating intermediate files. They are powerful because you can chain them together and apply them on huge rasters and mosaics on the fly.

In this repository, you will find useful function chains (*.rft.xml) created by the Esri community. You can also create custom raster functions in Python that work seamlessly with the several dozen functions that ship with ArcGIS.

Getting Started

  1. Install ArcGIS for Desktop 10.4 or higher or pro 1.2 or higher, or ArcGIS for Server 10.4 or higher.
  2. Install the latest release of prerequisite Python extension packages if you are setting up for the first time:
    • Download Python extensions binaries.
    • Unzip the contents to a temporary local folder.
    • Run <local-folder>/setup.py with administrator privileges.
  3. Install the latest release of custom raster functions:
    • Download all custom raster functions. If you are using pro use the master branch. If you are using arcmap use the arcmap107 branch
    • Unzip the contents locally to a home folder.
    • You'll find ready-to-use templates and functions in their own subfolders.
  4. Learn more about raster functions, function chains, and templates using the Resources below.
  5. Learn how you can create new raster functions using the Python API.

Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Featured Raster Functions and Templates

  • Key Metadata

    KeyMetadata.py demonstrates how key properties can be introduced or overridden by a raster function. These are the inputs to the function:

    • Property Name, Property Value—The name and value of the dataset-level key property to update or introduce.
    • Band Names—Band names of the outgoing raster specified as a CSV.
    • Metadata JSON—Key metadata to be injected into the outgoing raster described as a JSON string representing a collection of key-value pairs. Learn more here.

    This function serves as an example of one that doesn't need to implement the .updatePixels() method.

  • Mask Raster

    MaskRaster.py enables you to apply the input mask raster as the NoData mask on the primary input raster.

    MaskRaster.rft.xml is a grouping raster function template where the inputs are the primary raster and the mask raster (in that order).

  • Select By Pixel Size

    SelectByPixelSize.py accepts two overlapping rasters and a threshold value indicating the resolution at which the function switches from returning the first raster to returning the second raster as output. If unspecified, the threshold parameter defaults to the average cell size of the two input rasters.

    SelectByPixelSize.rft.xml is a grouping raster function template that accepts two rasters as input and leaves threshold unspecified.

  • Fish Habitat Suitability

    FishHabitatSuitability.py returns a raster representing suitability of fish habitat at a user-specified ocean depth given two rasters representing water temperature and salinity. This function demonstrates how raster functions can be exploited in analytic workflows.

    FishHabitatSuitability.rft.xml is a grouping raster function template that accepts the temperature and salinity rasters (in that order). This template—when used in the Add Rasters to Mosaic Dataset tool with the Table raster type or as a processing template on a mosaic dataset—is capable of obtaining the value of the depth parameter from a specific field (StdZ, if available) in the table.

  • Vineyard Analysis

    VineyardAnalysis.py serves to demonstrate how you can compute a suitability raster given the elevation, slope, and aspect of the region.

    VineyardAnalysis.rft.xml accepts the elevation input raster and uses built-in raster functions to compute slope and elevation before feeding the output to the Vineyard Analysis raster function.

  • Topographic C-Correction

    Topographic c-correction is used to remove the effects of hillshade on multispectral images. It reduces the effects of reflectance variability in areas of high or rugged terrain, thus improving the consistency of the multispectral image pixel values and the quality of images as additional processing is applied. There are many different topographic correction algorithms. These algorithms have been compared by Ion Sola et. al (2016) and the c-correction proposed in Teillet, Guindon, and Goodenough (1982) was ranked as one of the best topographic correction methods.

Licensing

Copyright 2014 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's License.txt file.

Subscribe to our newsletter