Class RasterFunction


  • public class RasterFunction
    extends java.lang.Object
    Represents operations that can be performed on one or more rasters or a mosaic dataset by applying on-the-fly processing.

    Examples include Colormap, Hillshade, ShadedRelief.

    The arguments of the raster function should be initialized before it can be processed. Use getArguments() to get the arguments.

    The processed result can be rendered by creating a new raster using Raster(RasterFunction). This raster can then be binded to a raster layer using RasterLayer(Raster).

    Example for working with a Raster Function:

     
     RasterFunction rasterFunction = new RasterFunction("absolute-file-path-of-raster-function-json");
     
     // get the arguments of the raster function
     RasterFunctionArguments rasterFunctionArguments = rasterFunction.getArguments();
     
     // initialize the arguments
     List<String> rasterNames = rasterFunctionArguments.getRasterNames();
     // assuming rasterNames has 2 entries, set the 2 rasters
     rasterFunctionArguments.setRaster(rasterNames.get(0), new Raster("absolute-file-path-of-raster0");
     rasterFunctionArguments.setRaster(rasterNames.get(1), new Raster("absolute-file-path-of-raster1");
     
     // create a new raster based on the function
     Raster raster = new Raster(rasterFunction);
     
     // create a layer to display the processed result
     RasterLayer rasterLayer = new RasterLayer(raster);
     
    Since:
    100.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      RasterFunction​(java.lang.String jsonFilePath)
      Creates a raster function based on JSON file path.
    • Constructor Detail

      • RasterFunction

        public RasterFunction​(java.lang.String jsonFilePath)
        Creates a raster function based on JSON file path.
        Parameters:
        jsonFilePath - absolute file path to JSON that contains the raster function
        Throws:
        java.lang.IllegalArgumentException - if jsonFilePath is null or empty
        ArcGISRuntimeException - if file does not exist at jsonFilePath
        Since:
        100.0.0
    • Method Detail

      • fromJson

        public static RasterFunction fromJson​(java.lang.String json)
        Creates a RasterFunction instance from a JSON string.
        Parameters:
        json - a JSON string that represents a RasterFunction
        Returns:
        a RasterFunction instance
        Throws:
        java.lang.IllegalArgumentException - if json is null or empty
        ArcGISRuntimeException - if json is invalid
        Since:
        100.1.0
      • getArguments

        public RasterFunctionArguments getArguments()
        Returns the arguments of this function.
        Returns:
        the arguments of this function
        Since:
        100.0.0