ArcGIS Runtime SDK for WPF - Library Reference
RenderingRule Property
See Also  Example
ESRI.ArcGIS.Client Namespace > ArcGISImageServiceLayer Class : RenderingRule Property

Gets or sets the rendering rule which provides a set of predefined raster functions to dynamically change the display of the ArcGISImageServiceLayer.

Syntax

Visual Basic (Declaration) 
Public Property RenderingRule As RenderingRule
C# 
public RenderingRule RenderingRule {get; set;}

Remarks

The following lists the rendering rule functions, with hyperlinks to conceptual documentation, that are supported by the RenderingRule property:

It is required to create a RenderingRule class and set the appropriate properties in order set the ArcGISImageServiceLayer.RenderingRule property.

Example

C#Copy Code
public void Make_Aspect()
{
                
  // Create a RenderingRule for the 'Aspect' raster function.
                
  // Read the following conceptual documentation to understand the valid arguments necessary to create
  // a successful RenderingRule.
  // http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Aspect_function/009t00000047000000/
                
  // This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  // Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  // an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  // ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
                
  // ---------------------------------------------------------------------------------------------------------------------
                
  // Display the default ArcGISImageServiceLayer in Map1
  // ===================================================
                
  // Create an ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
                
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
                
  // Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1);
                
  // -----------------------------------------------------------------------------------------------------------------------
                
  // Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  // ==========================================================================
                
  // Create another ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer2 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
                
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
                
  // Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2);
                
  // Define the custom RenderingRule
  ESRI.ArcGIS.Client.RenderingRule myRenderingRule = new ESRI.ArcGIS.Client.RenderingRule();
                
  // Note: The .RasterFunctonName must use the text string 'Aspect'.
  myRenderingRule.RasterFunctionName = "Aspect";
                
}
                
public void Make_Colormap()
{
                
  // Create a RenderingRule for the 'Colormap' raster function.
                
  // Read the following conceptual documentation to understand the valid arguments necessary to create
  // a successful RenderingRule.
  // http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Colormap_function/009t00000049000000/
                
  // This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  // Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  // an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  // ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
                
  // ---------------------------------------------------------------------------------------------------------------------
                
  // Display the default ArcGISImageServiceLayer in Map1
  // ===================================================
                
  // Create an ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
                
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
                
  // Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1);
                
  // -----------------------------------------------------------------------------------------------------------------------
                
  // Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  // ==========================================================================
                
  // Create another ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer2 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
                
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
                
  // Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2);
                
  // Define the custom RenderingRule
  ESRI.ArcGIS.Client.RenderingRule myRenderingRule = new ESRI.ArcGIS.Client.RenderingRule();
                
  // Note: The .RasterFunctonName must use the text string 'Colormap'.
  myRenderingRule.RasterFunctionName = "Colormap";
                
  // Note: the .VariableName must use the text string 'Raster'.
  myRenderingRule.VariableName = "Raster";
                
                
  // Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  // Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dictionary<string, object> rasterParams = new Dictionary<string, object>();
                
  // Example #1: Create a random set of colors for the color map.
  // Note: The a key of 'ColormapName' takes the string 'Random'.
  rasterParams.Add("ColormapName", "Random");
                
  // Example #2: Create a Normalized Difference Vegetation Index (NDVI) set of colors for the color map.
  // Note: The a key of 'ColormapName' takes the string 'NDVI'.
  //rasterParams.Add("ColormapName", "NDVI");
                
  // Example #3: Create a elevation stylized set of colors for the color map.
  // Note: The a key of 'ColormapName' takes the string 'Elevation'.
  //rasterParams.Add("ColormapName", "Elevation");
                
  // Example #4: Create a gray scale set of colors for the color map.
  // Note: The a key of 'ColormapName' takes the string 'Gray'.
  //rasterParams.Add("ColormapName", "Gray");
                
  // Example #5: Create a custom color mapping set of colors for the color map.
  // Note: The Colormap raster function requires a defined set of color mapping values to define 
  // which pixels will be assigned to a specific color. Defining the color mapping values can be 
  // lengthy depending on the number of pixel values of the image and the number of colors desired. 
  // Since defining these color maps is used by several raster functions, a shared function to 
  // define the color mappings will be used. See the CreateColorMap function for more details on 
  // what the color mappings are.
  //rasterParams.Add("Colormap", CreateColorMap());
                
  // Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams;
                
                
  // Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule;
                
}
                
public void Make_Hillshade()
{
                
  // Create a RenderingRule for the 'Hillshade' raster function.
                
  // Read the following conceptual documentation to understand the valid arguments necessary to create
  // a successful RenderingRule.
  // http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Hillshade_function/009t0000004z000000/
                
  // This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  // Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  // an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  // ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
                
  // ---------------------------------------------------------------------------------------------------------------------
                
  // Display the default ArcGISImageServiceLayer in Map1
  // ===================================================
  
  // Create an ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1);
  
  // -----------------------------------------------------------------------------------------------------------------------
  
  // Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  // ==========================================================================
  
  // Create another ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer2 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
   myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2);
  
  
  // Define the custom RenderingRule
  ESRI.ArcGIS.Client.RenderingRule myRenderingRule = new ESRI.ArcGIS.Client.RenderingRule();
  
  // Note: The .RasterFunctonName must use the text string 'Hillshade'.
  myRenderingRule.RasterFunctionName = "Hillshade";
  
  // Note: the .VariableName must use the text string 'DEM'.
  myRenderingRule.VariableName = "DEM";
  
  
  // Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  // Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dictionary<string, object> rasterParams = new Dictionary<string, object>();
  
  // Note: The a key of 'Azimuth' takes a double for it's object value pair.
  rasterParams.Add("Azimuth", 215.0);
  
  // Note: The a key of 'Altitude' takes a double for it's object value pair.
  rasterParams.Add("Altitude", 60.0);
  
  // Note: The a key of 'ZFactor' takes a double for it's object value pair.
  rasterParams.Add("ZFactor", 3.2);
  
  // Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams;
  
  
  // Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule;
  
}
  
public void Make_NDVI()
{
  
  // Create a RenderingRule for the 'NDVI' raster function.
  
  // Read the following conceptual documentation to understand the valid arguments necessary to create
  // a successful RenderingRule.
  // http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/NDVI_function/009t00000052000000/
  
  // This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  // Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  // an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  // ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  // ---------------------------------------------------------------------------------------------------------------------
  
  // Display the default ArcGISImageServiceLayer in Map1
  // ===================================================
  
  // Create an ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This IS a Mosaic dataset. The ArcGISImageServiceLayer has FOUR bands.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1);
  // -----------------------------------------------------------------------------------------------------------------------
  
  // Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  // ==========================================================================
  
  // Create another ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer2 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This IS a Mosaic dataset. The ArcGISImageServiceLayer has FOUR bands.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2);
  
  // Define the custom RenderingRule
  ESRI.ArcGIS.Client.RenderingRule myRenderingRule = new ESRI.ArcGIS.Client.RenderingRule();
  
  // Note: The .RasterFunctonName must use the text string 'NDVI'.
  myRenderingRule.RasterFunctionName = "NDVI";
  
  // Note: the .VariableName must use the text string 'Raster'.
   myRenderingRule.VariableName = "Raster";
  
  
  // Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  // Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dictionary<string, object> rasterParams = new Dictionary<string, object>();
  
  // Note: The a key of 'VisibleBandID' takes an integer for it's object value pair.
  rasterParams.Add("VisibleBandID", 0);
  
  // Note: The a key of 'InfraredBandID' takes an integer for it's object value pair.
  rasterParams.Add("InfraredBandID", 3);
  
  // Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams;
  
  
  // Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule;
  
}
  
public void Make_ShadedRelief()
  {
  
  // Create a RenderingRule for the 'ShadedRelief' raster function.
  
  // Read the following conceptual documentation to understand the valid arguments necessary to create
  // a successful RenderingRule.
  // http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Shaded_Relief_function/009t00000055000000/
  
  // This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  // Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  // an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  // ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  // ---------------------------------------------------------------------------------------------------------------------
  
  // Display the default ArcGISImageServiceLayer in Map1
  // ===================================================
  
  // Create an ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1);
  
  // -----------------------------------------------------------------------------------------------------------------------
  
  // Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  // ==========================================================================
  
  // Create another ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer2 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2);
  
  // Define the custom RenderingRule
  ESRI.ArcGIS.Client.RenderingRule myRenderingRule = new ESRI.ArcGIS.Client.RenderingRule();
  
  // Note: The .RasterFunctonName must use the text string 'ShadedRelief'.
  myRenderingRule.RasterFunctionName = "ShadedRelief";
  
  // Note: the .VariableName must use the text string 'Raster'.
  myRenderingRule.VariableName = "Raster";
  
  
  // Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  // Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dictionary<string, object> rasterParams = new Dictionary<string, object>();
  
  // Note: The a key of 'Azimuth' takes a double for it's object value pair.
  rasterParams.Add("Azimuth", 215.0);
  
  // Note: The a key of 'Altitude' takes a double for it's object value pair.
  rasterParams.Add("Altitude", 60.0);
  
  // Note: The a key of 'ZFactor' takes a double for it's object value pair.
  rasterParams.Add("ZFactor", 3.2);
  
  // Note: The ShadedRelief raster function requires a defined set of color mapping values to define which
  // pixels will be assigned to a specific color. Defining the color mapping values can be lengthy depending 
  // on the number of pixel values of the image and the number of colors desired. Since defining these color 
  // maps is used by several raster functions, a shared function to define the color mappings will be used. 
  // See the CreateColorMap function for more details on what the color mappings are.
  rasterParams.Add("Colormap", CreateColorMap());
  
  // Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams;
  
  
  // Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule;
  
}
  
public void Make_Slope()
{
  
  // Create a RenderingRule for the 'Slope' raster function.
  
  // Read the following conceptual documentation to understand the valid arguments necessary to create
  // a successful RenderingRule.
  // http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Slope_function/009t00000056000000/
  
  // This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  // Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  // an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  // ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  // ---------------------------------------------------------------------------------------------------------------------
  
  // Display the default ArcGISImageServiceLayer in Map1
  // ===================================================
  
  // Create an ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1);
  
  // -----------------------------------------------------------------------------------------------------------------------
  
  // Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  // ==========================================================================
  
  // Create another ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer2 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2);
  
  // Define the custom RenderingRule
  ESRI.ArcGIS.Client.RenderingRule myRenderingRule = new ESRI.ArcGIS.Client.RenderingRule();
  
  // Note: The .RasterFunctonName must use the text string 'Slope'.
  myRenderingRule.RasterFunctionName = "Slope";
  
  // Note: the .VariableName must use the text string 'DEM'.
  myRenderingRule.VariableName = "DEM";
  
  // Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  // Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dictionary<string, object> rasterParams = new Dictionary<string, object>();
  
  // Note: The a key of 'ZFactor' takes a double for it's object value pair.
  rasterParams.Add("ZFactor", 3.2);
  
  // Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams;
  
  
  // Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule;
  
}
                
public void Make_Statistics()
{
                
  // Create a RenderingRule for the 'Statistics' raster function.
  
  // Read the following conceptual documentation to understand the valid arguments necessary to create
  // a successful RenderingRule.
  // http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Statistics_function/009t00000058000000/
  
  // This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  // Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  // an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  // ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  // ---------------------------------------------------------------------------------------------------------------------
  
  // Display the default ArcGISImageServiceLayer in Map1
  // ===================================================
  
  // Create an ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
   myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1);
  
  // -----------------------------------------------------------------------------------------------------------------------
  
  // Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  // ==========================================================================
  
  // Create another ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer2 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2);
  
  // Define the custom RenderingRule
  ESRI.ArcGIS.Client.RenderingRule myRenderingRule = new ESRI.ArcGIS.Client.RenderingRule();
  
  // Note: The .RasterFunctonName must use the text string 'Statistics'.
  myRenderingRule.RasterFunctionName = "Statistics";
  
  // Note: the .VariableName must use the text string 'Raster'.
  myRenderingRule.VariableName = "Raster";
  
  
  // Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  // Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dictionary<string, object> rasterParams = new Dictionary<string, object>();
  
  // Note: The a key of 'KernelColumns' takes an integer.
  rasterParams.Add("KernelColumns", 30);
  
  // Note: The a key of 'KernelRows' takes an integer.
  rasterParams.Add("KernelRows", 30);
  
  // Example #1: Calculate the minimum value of the pixels within the focal neighborhood 
  // Note: The a key of 'Type' takes the string 'Min'.
  rasterParams.Add("Type", "Min");
  
  // Example #2: Calculate the maximum value of the pixels within the focal neighborhood 
  // Note: The a key of 'Type' takes the string 'Max'.
  //rasterParams.Add("Type", "Max");
  
  // Example #3: Calculate the average value of the pixels within the focal neighborhood 
  // Note: The a key of 'Type' takes the string 'Mean'.
  //rasterParams.Add("Type", "Mean");
  
  // Example #4: Calculate the standard deviation value of the pixels within the focal neighborhood 
  // Note: The a key of 'Type' takes the string 'StandardDeviation'.
  //rasterParams.Add("Type", "StandardDeviation");
  
  // Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams;
  
  
  // Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
   myArcGISImageServiceLayer2.RenderingRule = myRenderingRule;
  
} 
  
public void Make_Stretch()
{
  
  // Create a RenderingRule for the 'Stretch' raster function.
  
  // Read the following conceptual documentation to understand the valid arguments necessary to create
  // a successful RenderingRule.
  // http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Stretch_function/009t00000059000000/
  
  // This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  // Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  // an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  // ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
   // ---------------------------------------------------------------------------------------------------------------------
  
  // Display the default ArcGISImageServiceLayer in Map1
  // ===================================================
  
  // Create an ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This IS a Mosaic dataset. The ArcGISImageServiceLayer has FOUR bands.
   myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1);
  
  // -----------------------------------------------------------------------------------------------------------------------
  
  // Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  // ==========================================================================
  
  // Create another ArcGISImageServiceLayer
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer2 = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  
  // This IS a Mosaic dataset. The ArcGISImageServiceLayer has FOUR bands.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer";
  
  // Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2);
  
  // Define the custom RenderingRule
  ESRI.ArcGIS.Client.RenderingRule myRenderingRule = new ESRI.ArcGIS.Client.RenderingRule();
  
  // Note: The .RasterFunctonName must use the text string 'Stretch'.
  myRenderingRule.RasterFunctionName = "Stretch";
  
  // Note: the .VariableName must use the text string 'Raster'.
  myRenderingRule.VariableName = "Raster";
  
  
  // Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  // Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dictionary<string, object> rasterParams = new Dictionary<string, object>();
  
  // Note: The a key of 'NumberOfStandardDeviations' takes an integer for it's object value pair.
  rasterParams.Add("NumberOfStandardDeviations", 2);
  
  // Note: The a key of 'Statistics' takes an array of arrays for it's object value pair. Each nested 
  // array contains the relevant statistics information {minimum, maximum, mean, standard deviation} 
  // for each band in the Mosaic raster dataset. The statistics information for each band is obtained 
  // via the following properties:
  // minimum = ArcGISImageServiceLayer.MinValues
  // maximum = ArcGISImageServiceLayer.MaxValues
  // mean = ArcGISImageServiceLayer.MeanValues
  // standard deviation = ArcGISImageServiceLayer.StdvValues
   rasterParams.Add("Statistics", new double[][]{
  new double[]{0.0, 254, 29.4, 27.9}, 
  new double []{0.0, 254, 29.3, 19.2}, 
  new double []{0.0, 254, 42.0, 17.9}, 
  new double[]{0, 254, 59.9, 27.6}});
  
  // Note: The a key of 'Gamma' takes an array of doubles (one for each band) for it's object value pair.
  rasterParams.Add("Gamma", new double[] { 0.5, 0.5, 0.5, 0.5 });
  
  // Example #1: Calculate the stretch function using the stretch type of 'None'. 
  // Note: The key of 'StretchType' takes the integer value 0.
  rasterParams.Add("StretchType", 0);
  
  // Example #2: Calculate the stretch function using the stretch type of 'Standard Deviation'. 
  // Note: The key of 'StretchType' takes the integer value 3.
  //rasterParams.Add("StretchType", 3);
  
  // Example #3: Calculate the stretch function using the stretch type of 'Histogram Equalization'. 
  // Note: The key of 'StretchType' takes the integer value 4.
  //rasterParams.Add("StretchType", 4);
  
  // Example #4: Calculate the stretch function using the stretch type of 'MinMax'. 
  // Note: The key of 'StretchType' takes the integer value 5.
  //rasterParams.Add("StretchType", 5);
  
  // Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams;
  
  
  // Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule;
  
}
  
public int[][] CreateColorMap()
{
  
  // This sample function creates a sample color mapping for a specific Digital Elevation Model 
  // (DEM) with pixels values that range from 0 to 255. The way the color ramp works is an array 
  // of arrays is created in which each pixel has a specific color defined with Red, Green and 
  // Blue integer values. 
  // For example the line:
  // New Integer() {0, 175, 240, 233}
  // means that for the pixel value = 0, create a color where Red is 175, Green is 240, and Blue 
  // is 233.
  // 
  // Note:
  // If a particular pixel value is not defined with a color and yet that pixel value is to be 
  // rendered it will be shown as transparent. Only those pixel values that have a defined color 
  // will be rendered with that color. In the example array below, if the pixel value of 2 exists 
  // in the DEM it will render as transparent since no color was explicitly defined in the array 
  // of arrays.
  //
  // A color map is different than a color ramp. Color ramps are defined and behave similar to 
  // color maps with the exception that if a pixel value is to be rendered and it is not explicitly 
  // defined in the array, then a color will automatically be generated that is between two closest 
  // two pixel values for which colors are defined.
  // 
  // The RenderingRule raster functions of ColorMap and ShadedRelief that are used for the 
  // ArcGISImageServiceLayer only use color maps.
  
  int[][] sampleColormap =
  {
    new int[] {0, 175, 240, 233},
    new int[] {3, 175, 240, 222},
    new int[] {7, 177, 242, 212},
    new int[] {11, 177, 242, 198},
    new int[] {15, 176, 245, 183},
    new int[] {19, 185, 247, 178},
    new int[] {23, 200, 247, 178},
    new int[] {27, 216, 250, 177},
    new int[] {31, 232, 252, 179},
    new int[] {35, 248, 252, 179},
    new int[] {39, 238, 245, 162},
    new int[] {43, 208, 232, 135},
    new int[] {47, 172, 217, 111},
    new int[] {51, 136, 204, 88},
    new int[] {55, 97, 189, 66},
    new int[] {59, 58, 176, 48},
    new int[] {63, 32, 161, 43},
    new int[] {67, 18, 148, 50},
    new int[] {71, 5, 133, 58},
    new int[] {75, 30, 130, 62},
    new int[] {79, 62, 138, 59},
    new int[] {83, 88, 145, 55},
    new int[] {87, 112, 153, 50},
    new int[] {91, 136, 158, 46},
    new int[] {95, 162, 166, 41},
    new int[] {99, 186, 171, 34},
    new int[] {103, 212, 178, 25},
    new int[] {107, 237, 181, 14},
    new int[] {111, 247, 174, 2},
    new int[] {115, 232, 144, 2},
    new int[] {119, 219, 118, 2},
    new int[] {123, 204, 93, 2},
    new int[] {127, 191, 71, 2},
    new int[] {131, 176, 51, 2},
    new int[] {135, 163, 34, 2},
    new int[] {139, 148, 21, 1},
    new int[] {143, 135, 8, 1},
    new int[] {147, 120, 5, 1},
    new int[] {151, 117, 14, 2},
    new int[] {155, 117, 22, 5},
    new int[] {159, 115, 26, 6},
    new int[] {163, 112, 31, 7},
    new int[] {167, 112, 36, 8},
    new int[] {171, 110, 37, 9},
    new int[] {175, 107, 41, 11},
    new int[] {179, 107, 45, 12},
    new int[] {183, 105, 48, 14},
    new int[] {187, 115, 61, 28},
    new int[] {191, 122, 72, 40},
    new int[] {195, 133, 86, 57},
    new int[] {199, 140, 99, 73},
    new int[] {203, 148, 111, 90},
    new int[] {207, 153, 125, 109},
    new int[] {213, 163, 148, 139},
    new int[] {217, 168, 163, 160},
    new int[] {223, 179, 179, 179},
    new int[] {227, 189, 189, 189},
    new int[] {231, 196, 196, 196},
    new int[] {235, 207, 204, 207},
    new int[] {239, 217, 215, 217},
    new int[] {243, 224, 222, 224},
    new int[] {247, 235, 232, 235},
    new int[] {251, 245, 242, 245},
    new int[] {255, 255, 252, 255}
  };
    
  return sampleColormap;
    
}
VB.NETCopy Code
Public Sub Make_Aspect()
                
  ' Create a RenderingRule for the 'Aspect' raster function.
  
  ' Read the following conceptual documentation to understand the valid arguments necessary to create
  ' a successful RenderingRule.
  ' http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Aspect_function/009t00000047000000/
  
  ' This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  ' Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  ' an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  ' ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  ' ---------------------------------------------------------------------------------------------------------------------
  
  ' Display the default ArcGISImageServiceLayer in Map1
  ' ===================================================
  
  ' Create an ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1)
  
  ' -----------------------------------------------------------------------------------------------------------------------
  
  ' Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  ' ==========================================================================
  
  ' Create another ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer2 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2)
  
  ' Define the custom RenderingRule
  Dim myRenderingRule As New ESRI.ArcGIS.Client.RenderingRule()
  
  ' Note: The .RasterFunctonName must use the text string 'Aspect'.
          myRenderingRule.RasterFunctionName = "Aspect"
  
End Sub
  
Public Sub Make_Colormap()
  
  ' Create a RenderingRule for the 'Colormap' raster function.
  
  ' Read the following conceptual documentation to understand the valid arguments necessary to create
  ' a successful RenderingRule.
  ' http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Colormap_function/009t00000049000000/
  
  ' This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  ' Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  ' an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  ' ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  ' ---------------------------------------------------------------------------------------------------------------------
  
  ' Display the default ArcGISImageServiceLayer in Map1
  ' ===================================================
  
  ' Create an ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1)
  
  ' -----------------------------------------------------------------------------------------------------------------------
  
  ' Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  ' ==========================================================================
  
  ' Create another ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer2 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2)
  
  ' Define the custom RenderingRule
  Dim myRenderingRule As New ESRI.ArcGIS.Client.RenderingRule()
  
  ' Note: The .RasterFunctonName must use the text string 'Colormap'.
  myRenderingRule.RasterFunctionName = "Colormap"
  
  ' Note: the .VariableName must use the text string 'Raster'.
  myRenderingRule.VariableName = "Raster"
  
  
  ' Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  ' Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dim rasterParams As New Dictionary(Of String, Object)()
  
  ' Example #1: Create a random set of colors for the color map.
  ' Note: The a key of 'ColormapName' takes the string 'Random'.
  rasterParams.Add("ColormapName", "Random")
  
  ' Example #2: Create a Normalized Difference Vegetation Index (NDVI) set of colors for the color map.
  ' Note: The a key of 'ColormapName' takes the string 'NDVI'.
  'rasterParams.Add("ColormapName", "NDVI")
  
  ' Example #3: Create a elevation stylized set of colors for the color map.
  ' Note: The a key of 'ColormapName' takes the string 'Elevation'.
  'rasterParams.Add("ColormapName", "Elevation")
  
  ' Example #4: Create a gray scale set of colors for the color map.
  ' Note: The a key of 'ColormapName' takes the string 'Gray'.
  'rasterParams.Add("ColormapName", "Gray")
  
  ' Example #5: Create a custom color mapping set of colors for the color map.
  ' Note: The Colormap raster function requires a defined set of color mapping values to define 
  ' which pixels will be assigned to a specific color. Defining the color mapping values can be 
  ' lengthy depending on the number of pixel values of the image and the number of colors desired. 
  ' Since defining these color maps is used by several raster functions, a shared function to 
  ' define the color mappings will be used. See the CreateColorMap function for more details on 
  ' what the color mappings are.
  'rasterParams.Add("Colormap", CreateColorMap)
  
  ' Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams
  
  
  ' Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule
  
End Sub
  
Public Sub Make_Hillshade()
  
  ' Create a RenderingRule for the 'Hillshade' raster function.
  
  ' Read the following conceptual documentation to understand the valid arguments necessary to create
  ' a successful RenderingRule.
  ' http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Hillshade_function/009t0000004z000000/
  
  ' This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  ' Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  ' an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  ' ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  ' ---------------------------------------------------------------------------------------------------------------------
  
  ' Display the default ArcGISImageServiceLayer in Map1
  ' ===================================================
  
  ' Create an ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1)
  
  ' -----------------------------------------------------------------------------------------------------------------------
  
  ' Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  ' ==========================================================================
  
  ' Create another ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer2 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2)
  
  
  ' Define the custom RenderingRule
  Dim myRenderingRule As New ESRI.ArcGIS.Client.RenderingRule()
  
  ' Note: The .RasterFunctonName must use the text string 'Hillshade'.
  myRenderingRule.RasterFunctionName = "Hillshade"
  
  ' Note: the .VariableName must use the text string 'DEM'.
  myRenderingRule.VariableName = "DEM"
  
  
  ' Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  ' Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dim rasterParams As New Dictionary(Of String, Object)()
  
  ' Note: The a key of 'Azimuth' takes a double for it's object value pair.
  rasterParams.Add("Azimuth", 215.0)
  
  ' Note: The a key of 'Altitude' takes a double for it's object value pair.
  rasterParams.Add("Altitude", 60.0)
  
  ' Note: The a key of 'ZFactor' takes a double for it's object value pair.
  rasterParams.Add("ZFactor", 3.2)
  
  ' Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams
  
  
  ' Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule
  
End Sub
  
Public Sub Make_NDVI()
  
  ' Create a RenderingRule for the 'NDVI' raster function.
  
  ' Read the following conceptual documentation to understand the valid arguments necessary to create
  ' a successful RenderingRule.
  ' http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/NDVI_function/009t00000052000000/
  
  ' This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  ' Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  ' an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  ' ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  ' ---------------------------------------------------------------------------------------------------------------------
  
  ' Display the default ArcGISImageServiceLayer in Map1
  ' ===================================================
  
  ' Create an ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This IS a Mosaic dataset. The ArcGISImageServiceLayer has FOUR bands.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1)
  ' -----------------------------------------------------------------------------------------------------------------------
  
  ' Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  ' ==========================================================================
  
  ' Create another ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer2 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This IS a Mosaic dataset. The ArcGISImageServiceLayer has FOUR bands.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2)
  
  ' Define the custom RenderingRule
  Dim myRenderingRule As New ESRI.ArcGIS.Client.RenderingRule()
  
  ' Note: The .RasterFunctonName must use the text string 'NDVI'.
  myRenderingRule.RasterFunctionName = "NDVI"
  
  ' Note: the .VariableName must use the text string 'Raster'.
  myRenderingRule.VariableName = "Raster"
  
  
  ' Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  ' Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dim rasterParams As New Dictionary(Of String, Object)()
  
  ' Note: The a key of 'VisibleBandID' takes an integer for it's object value pair.
  rasterParams.Add("VisibleBandID", 0)
  
  ' Note: The a key of 'InfraredBandID' takes an integer for it's object value pair.
  rasterParams.Add("InfraredBandID", 3)
  
  ' Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams
  
  
  ' Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule
  
End Sub
  
Public Sub Make_ShadedRelief()
  
  ' Create a RenderingRule for the 'ShadedRelief' raster function.
  
  ' Read the following conceptual documentation to understand the valid arguments necessary to create
  ' a successful RenderingRule.
  ' http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Shaded_Relief_function/009t00000055000000/
  
  ' This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  ' Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  ' an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  ' ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  ' ---------------------------------------------------------------------------------------------------------------------
  
  ' Display the default ArcGISImageServiceLayer in Map1
  ' ===================================================
  
  ' Create an ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1)
  
  ' -----------------------------------------------------------------------------------------------------------------------
  
  ' Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  ' ==========================================================================
  
  ' Create another ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer2 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2)
  
  ' Define the custom RenderingRule
  Dim myRenderingRule As New ESRI.ArcGIS.Client.RenderingRule()
  
  ' Note: The .RasterFunctonName must use the text string 'ShadedRelief'.
  myRenderingRule.RasterFunctionName = "ShadedRelief"
  
  ' Note: the .VariableName must use the text string 'Raster'.
  myRenderingRule.VariableName = "Raster"
  
  
  ' Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  ' Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dim rasterParams As New Dictionary(Of String, Object)()
  
  ' Note: The a key of 'Azimuth' takes a double for it's object value pair.
  rasterParams.Add("Azimuth", 215.0)
  
  ' Note: The a key of 'Altitude' takes a double for it's object value pair.
  rasterParams.Add("Altitude", 60.0)
  
  ' Note: The a key of 'ZFactor' takes a double for it's object value pair.
  rasterParams.Add("ZFactor", 3.2)
  
  ' Note: The ShadedRelief raster function requires a defined set of color mapping values to define which
  ' pixels will be assigned to a specific color. Defining the color mapping values can be lengthy depending 
  ' on the number of pixel values of the image and the number of colors desired. Since defining these color 
  ' maps is used by several raster functions, a shared function to define the color mappings will be used. 
  ' See the CreateColorMap function for more details on what the color mappings are.
  rasterParams.Add("Colormap", CreateColorMap)
  
  ' Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams
  
  
  ' Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule
  
End Sub
  
Public Sub Make_Slope()
  
  ' Create a RenderingRule for the 'Slope' raster function.
  
  ' Read the following conceptual documentation to understand the valid arguments necessary to create
  ' a successful RenderingRule.
  ' http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Slope_function/009t00000056000000/
  
  ' This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  ' Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  ' an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  ' ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  ' ---------------------------------------------------------------------------------------------------------------------
  
  ' Display the default ArcGISImageServiceLayer in Map1
  ' ===================================================
  
  ' Create an ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1)
  
  ' -----------------------------------------------------------------------------------------------------------------------
  
  ' Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  ' ==========================================================================
  
  ' Create another ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer2 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2)
  
  ' Define the custom RenderingRule
  Dim myRenderingRule As New ESRI.ArcGIS.Client.RenderingRule()
  
  ' Note: The .RasterFunctonName must use the text string 'Slope'.
  myRenderingRule.RasterFunctionName = "Slope"
  
  ' Note: the .VariableName must use the text string 'DEM'.
  myRenderingRule.VariableName = "DEM"
  
  ' Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  ' Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dim rasterParams As New Dictionary(Of String, Object)()
  
  ' Note: The a key of 'ZFactor' takes a double for it's object value pair.
  rasterParams.Add("ZFactor", 3.2)
  
  ' Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams
  
  
  ' Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule
  
End Sub
  
Public Sub Make_Statistics()
  
  ' Create a RenderingRule for the 'Statistics' raster function.
  
  ' Read the following conceptual documentation to understand the valid arguments necessary to create
  ' a successful RenderingRule.
  ' http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Statistics_function/009t00000058000000/
  
  ' This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  ' Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  ' an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  ' ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  ' ---------------------------------------------------------------------------------------------------------------------
  
  ' Display the default ArcGISImageServiceLayer in Map1
  ' ===================================================
  
  ' Create an ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1)
  
  ' -----------------------------------------------------------------------------------------------------------------------
  
  ' Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  ' ==========================================================================
  
  ' Create another ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer2 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This is NOT a Mosaic dataset. The ArcGISImageServiceLayer has only ONE band.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2)
  
  ' Define the custom RenderingRule
  Dim myRenderingRule As New ESRI.ArcGIS.Client.RenderingRule()
  
  ' Note: The .RasterFunctonName must use the text string 'Statistics'.
  myRenderingRule.RasterFunctionName = "Statistics"
  
  ' Note: the .VariableName must use the text string 'Raster'.
  myRenderingRule.VariableName = "Raster"
  
  
  ' Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  ' Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dim rasterParams As New Dictionary(Of String, Object)()
  
  ' Note: The a key of 'KernelColumns' takes an integer.
  rasterParams.Add("KernelColumns", 30)
  
  ' Note: The a key of 'KernelRows' takes an integer.
  rasterParams.Add("KernelRows", 30)
  
  ' Example #1: Calculate the minimum value of the pixels within the focal neighborhood 
  ' Note: The a key of 'Type' takes the string 'Min'.
  rasterParams.Add("Type", "Min")
  
  ' Example #2: Calculate the maximum value of the pixels within the focal neighborhood 
  ' Note: The a key of 'Type' takes the string 'Max'.
  'rasterParams.Add("Type", "Max")
  
  ' Example #3: Calculate the average value of the pixels within the focal neighborhood 
  ' Note: The a key of 'Type' takes the string 'Mean'.
  'rasterParams.Add("Type", "Mean")
  
  ' Example #4: Calculate the standard deviation value of the pixels within the focal neighborhood 
  ' Note: The a key of 'Type' takes the string 'StandardDeviation'.
  'rasterParams.Add("Type", "StandardDeviation")
  
  ' Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams
  
  
  ' Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule
  
End Sub
  
Public Sub Make_Stretch()
  
  ' Create a RenderingRule for the 'Stretch' raster function.
  
  ' Read the following conceptual documentation to understand the valid arguments necessary to create
  ' a successful RenderingRule.
  ' http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Stretch_function/009t00000059000000/
  
  ' This example uses two Map controls to compare the effect of applying a RenderingRule. Map1 and 
  ' Map2 are ESRI.ArcGIS.Client.Map controls that were previously added to the XAML. Map1 will show 
  ' an ArcGISImageServiceLayer that comes by default from ArcGIS Server. Map2 will show the same 
  ' ArcGISImageServiceLayer but with a specific RenderingRule applied, to compare the differences.
  
  ' ---------------------------------------------------------------------------------------------------------------------
  
  ' Display the default ArcGISImageServiceLayer in Map1
  ' ===================================================
  
  ' Create an ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This IS a Mosaic dataset. The ArcGISImageServiceLayer has FOUR bands.
  myArcGISImageServiceLayer1.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map1 
  Map1.Layers.Add(myArcGISImageServiceLayer1)
  
  ' -----------------------------------------------------------------------------------------------------------------------
  
  ' Display the modified (via a RenderingRule) ArcGISImageServiceLayer in Map2
  ' ==========================================================================
  
  ' Create another ArcGISImageServiceLayer
  Dim myArcGISImageServiceLayer2 As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  
  ' This IS a Mosaic dataset. The ArcGISImageServiceLayer has FOUR bands.
  myArcGISImageServiceLayer2.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer"
  
  ' Add the ArcGISImageServiceLayer to Map2 
  Map2.Layers.Add(myArcGISImageServiceLayer2)
  
  ' Define the custom RenderingRule
  Dim myRenderingRule As New ESRI.ArcGIS.Client.RenderingRule()
  
  ' Note: The .RasterFunctonName must use the text string 'Stretch'.
  myRenderingRule.RasterFunctionName = "Stretch"
  
  ' Note: the .VariableName must use the text string 'Raster'.
  myRenderingRule.VariableName = "Raster"
  
  
  ' Define a Dictionary object with String/Object pairs. The Strings that are used for the keys as 
  ' Dictionary entries will need to have exact text strings depending on what raster function is being used.
  Dim rasterParams As New Dictionary(Of String, Object)()
  
  ' Note: The a key of 'NumberOfStandardDeviations' takes an integer for it's object value pair.
  rasterParams.Add("NumberOfStandardDeviations", 2)
  
  ' Note: The a key of 'Statistics' takes an array of arrays for it's object value pair. Each nested 
  ' array contains the relevant statistics information {minimum, maximum, mean, standard deviation} 
  ' for each band in the Mosaic raster dataset. The statistics information for each band is obtained 
  ' via the following properties:
  ' minimum = ArcGISImageServiceLayer.MinValues
  ' maximum = ArcGISImageServiceLayer.MaxValues
  ' mean = ArcGISImageServiceLayer.MeanValues
  ' standard deviation = ArcGISImageServiceLayer.StdvValues
  rasterParams.Add("Statistics", {{0.0, 254, 29.4, 27.9},
                                  {0.0, 254, 29.3, 19.2},
                                  {0.0, 254, 42.0, 17.9},
                                  {0, 254, 59.9, 27.6}})
  
  ' Note: The key of 'Gamma' takes an array of doubles (one for each band) for it's object value pair.
  rasterParams.Add("Gamma", {0.5, 0.5, 0.5, 0.5})
  
  ' Example #1: Calculate the stretch function using the stretch type of 'None'. 
  ' Note: The key of 'StretchType' takes the integer value 0.
  rasterParams.Add("StretchType", 0)
  
  ' Example #2: Calculate the stretch function using the stretch type of 'Standard Deviation'. 
  ' Note: The key of 'StretchType' takes the integer value 3.
  'rasterParams.Add("StretchType", 3)
  
  ' Example #3: Calculate the stretch function using the stretch type of 'Histogram Equalization'. 
  ' Note: The key of 'StretchType' takes the integer value 4.
  'rasterParams.Add("StretchType", 4)
  
  ' Example #4: Calculate the stretch function using the stretch type of 'MinMax'. 
  ' Note: The key of 'StretchType' takes the integer value 5.
  'rasterParams.Add("StretchType", 5)
  
  ' Add the rasterParms Dictionary as the RenderingRule's RasterFunctionArguments.
  myRenderingRule.RasterFunctionArguments = rasterParams
  
  
  ' Apply the user defined myRenderingRule to the ArcGISImageServiceLayer's .RenderingRule
  myArcGISImageServiceLayer2.RenderingRule = myRenderingRule
  
End Sub
  
Public Function CreateColorMap() As Integer()()
  
  ' This sample function creates a sample color mapping for a specific Digital Elevation Model 
  ' (DEM) with pixels values that range from 0 to 255. The way the color ramp works is an array 
  ' of arrays is created in which each pixel has a specific color defined with Red, Green and 
  ' Blue integer values. 
  ' For example the line:
  ' New Integer() {0, 175, 240, 233}
  ' means that for the pixel value = 0, create a color where Red is 175, Green is 240, and Blue 
  ' is 233.
  ' 
  ' Note:
  ' If a particular pixel value is not defined with a color and yet that pixel value is to be 
  ' rendered it will be shown as transparent. Only those pixel values that have a defined color 
  ' will be rendered with that color. In the example array below, if the pixel value of 2 exists 
  ' in the DEM it will render as transparent since no color was explicitly defined in the array 
  ' of arrays.
  '
  ' A color map is different than a color ramp. Color ramps are defined and behave similar to 
  ' color maps with the exception that if a pixel value is to be rendered and it is not explicitly 
  ' defined in the array, then a color will automatically be generated that is between two closest 
  ' two pixel values for which colors are defined.
  ' 
  ' The RenderingRule raster functions of ColorMap and ShadedRelief that are used for the 
  ' ArcGISImageServiceLayer only use color maps.
  
  Dim sampleColormap()() As Integer =
  {
    New Integer() {0, 175, 240, 233},
    New Integer() {3, 175, 240, 222},
    New Integer() {7, 177, 242, 212},
    New Integer() {11, 177, 242, 198},
    New Integer() {15, 176, 245, 183},
    New Integer() {19, 185, 247, 178},
    New Integer() {23, 200, 247, 178},
    New Integer() {27, 216, 250, 177},
    New Integer() {31, 232, 252, 179},
    New Integer() {35, 248, 252, 179},
    New Integer() {39, 238, 245, 162},
    New Integer() {43, 208, 232, 135},
    New Integer() {47, 172, 217, 111},
    New Integer() {51, 136, 204, 88},
    New Integer() {55, 97, 189, 66},
    New Integer() {59, 58, 176, 48},
    New Integer() {63, 32, 161, 43},
    New Integer() {67, 18, 148, 50},
    New Integer() {71, 5, 133, 58},
    New Integer() {75, 30, 130, 62},
    New Integer() {79, 62, 138, 59},
    New Integer() {83, 88, 145, 55},
    New Integer() {87, 112, 153, 50},
    New Integer() {91, 136, 158, 46},
    New Integer() {95, 162, 166, 41},
    New Integer() {99, 186, 171, 34},
    New Integer() {103, 212, 178, 25},
    New Integer() {107, 237, 181, 14},
    New Integer() {111, 247, 174, 2},
    New Integer() {115, 232, 144, 2},
    New Integer() {119, 219, 118, 2},
    New Integer() {123, 204, 93, 2},
    New Integer() {127, 191, 71, 2},
    New Integer() {131, 176, 51, 2},
    New Integer() {135, 163, 34, 2},
    New Integer() {139, 148, 21, 1},
    New Integer() {143, 135, 8, 1},
    New Integer() {147, 120, 5, 1},
    New Integer() {151, 117, 14, 2},
    New Integer() {155, 117, 22, 5},
    New Integer() {159, 115, 26, 6},
    New Integer() {163, 112, 31, 7},
    New Integer() {167, 112, 36, 8},
    New Integer() {171, 110, 37, 9},
    New Integer() {175, 107, 41, 11},
    New Integer() {179, 107, 45, 12},
    New Integer() {183, 105, 48, 14},
    New Integer() {187, 115, 61, 28},
    New Integer() {191, 122, 72, 40},
    New Integer() {195, 133, 86, 57},
    New Integer() {199, 140, 99, 73},
    New Integer() {203, 148, 111, 90},
    New Integer() {207, 153, 125, 109},
    New Integer() {213, 163, 148, 139},
    New Integer() {217, 168, 163, 160},
    New Integer() {223, 179, 179, 179},
    New Integer() {227, 189, 189, 189},
    New Integer() {231, 196, 196, 196},
    New Integer() {235, 207, 204, 207},
    New Integer() {239, 217, 215, 217},
    New Integer() {243, 224, 222, 224},
    New Integer() {247, 235, 232, 235},
    New Integer() {251, 245, 242, 245},
    New Integer() {255, 255, 252, 255}
  }
  
  Return sampleColormap
  
End Function

Requirements

Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8

See Also

© ESRI, Inc. All Rights Reserved.