Skip To Content ArcGIS for Developers Sign In Dashboard

RasterFunction Class

(Esri::ArcGISRuntime::RasterFunction)

An operation that can be performed on one or more rasters or a mosaic dataset by applying on-the-fly processing. More...

Header: #include <RasterFunction>
Since: Esri::ArcGISRuntime 100.0
Inherits: Object

Public Functions

RasterFunction(const QString &path, QObject *parent = nullptr)
~RasterFunction()
RasterFunctionArguments *arguments() const
  • 31 public functions inherited from QObject

Static Public Members

RasterFunction *fromJson(const QString &json, QObject *parent = nullptr)
  • 10 static public members inherited from QObject

Additional Inherited Members

Detailed Description

An operation that can be performed on one or more rasters or a mosaic dataset by applying on-the-fly processing.

Examples of RasterFunctions include Hillshade, Stretch, Colormap, Mask, and ShadedRelief, among others.

RasterFunctions in ArcGIS Runtime work very similarly to the ArcGIS REST API. The following workflow is a common way to render a raster using a raster function:

  1. Create a raster function via JSON. For example, the following JSON could be used for a Pansharpen function:
    {
      "raster_function":{"type":"Pansharpen_function"},
      "raster_function_arguments":
      {
        "weights":{"double_array":[0.10000000000000001,0.5,0.40000000000000002,0.29999999999999999],"type":"Raster_function_variable"},
        "pansharpen_type":{"pansharpen_type":"gram_schmidt","type":"Raster_function_variable"},
        "pan_raster":{"name":"pan_raster","is_raster":true,"type":"Raster_function_variable"},
        "raster":{"name":"raster","is_raster":true,"type":"Raster_function_variable"},
        "type":"Raster_function_arguments"
      },
      "type":"Raster_function_template"
    }

    For documentation on the ArcGIS Runtime JSON format and syntax for the different raster functions, please see the Guide topic Add raster data.

  2. Construct a RasterFunction object with the JSON created in step 1.
  3. Get the RasterFunctionArguments with arguments.
  4. Add rasters to the RasterFunctionArguments.
  5. Create a new Raster object with this RasterFunction.
  6. Create a new RasterLayer with the Raster object.
  7. Add the RasterLayer to a map or scene.

For further details on raster functions, please see the ArcGIS Desktop documentation.

Use an ImageServiceRaster as an argument for a raster function:

RasterFunction* rasterFunction = new RasterFunction(m_dataPath + "/hillshade_simplified.json", this);
RasterFunctionArguments* arguments = rasterFunction->arguments();
arguments->setRaster("raster", m_imageServiceRaster);

// create a new raster with the raster function and add to the operational layer
Raster* raster = new Raster(rasterFunction, this);
RasterLayer* rasterLayer = new RasterLayer(raster, this);

You can see the complete code in the C++ sample Raster Function Service.

Member Function Documentation

RasterFunction::RasterFunction(const QString &path, QObject *parent = nullptr)

Constructor that takes a path to a local JSON file and an optional parent.

RasterFunction::~RasterFunction()

Destructor.

RasterFunctionArguments *RasterFunction::arguments() const

Returns the arguments of this raster function.

[static] RasterFunction *RasterFunction::fromJson(const QString &json, QObject *parent = nullptr)

Creates a new RasterFunction from its JSON representation.

  • json - The JSON text.
  • parent - The optional parent.

Feedback on this topic?