ArcGIS API for WPF - Library Reference
MeanValues Property
See Also  Example Send comments on this topic
ESRI.ArcGIS.Client Namespace > ArcGISImageServiceLayer Class : MeanValues Property

Gets the mean of all the numerical value for each band in an ArcGISImageServiceLayer.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property MeanValues As Double()
C# 
public double[] MeanValues {get;}

Example

C#Copy Code
private void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
  
  // The Map1 object (a Map object) was defined previously in XAML.
  
  // Create an ArcGISImageServiceLayer.
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  myArcGISImageServiceLayer.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer";
            
  // Create an Event Handler.
  myArcGISImageServiceLayer.Initialized += new System.EventHandler<EventArgs>(ArcGISImageServiceLayer_Intialized);
                 
  // Add the ArcGISImageServiceLayer to the LayerCollection of the Map.
  Map1.Layers.Add(myArcGISImageServiceLayer);
                 
}
                 
private void ArcGISImageServiceLayer_Intialized(object sender, EventArgs e)
{
                 
  // The Map1 object (a Map object) and TextBlock_MeanValues (a TextBlock object) were defined previously in XAML.
                 
  // Access a specific ArcGISImageServiceLayer.
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer = (ESRI.ArcGIS.Client.ArcGISImageServiceLayer)Map1.Layers[0];
                 
  // MeanValues (Read Only)
  System.Double[] myMeanValues = myArcGISImageServiceLayer.MeanValues;
  if (myMeanValues != null)
  {
    string myMeanValuesText = "Num MeanValues: " + myMeanValues.Length.ToString();
    string myMeanValuesText2 = "";
    int i2 = 0;
    for (i2 = 0; i2 < myMeanValues.Length; i2++)
    {
      myMeanValuesText2 = myMeanValuesText2 + " " + myMeanValues[i2].ToString();
    }
    TextBlock_MeanValues.Text = myMeanValuesText + ". MeanValues: " + myMeanValuesText2;
  }
  else
  {
    TextBlock_MeanValues.Text = "[NO MeanValues SET]";
  }
                 
}
VB.NETCopy Code
Private Sub MainPage_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
                 
  ' The Map1 object (a Map object) was defined previously in XAML.
                 
  ' Create an ArcGISImageServiceLayer.
  Dim myArcGISImageServiceLayer As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  myArcGISImageServiceLayer.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer"
                 
  ' Create an Event Handler.
  AddHandler myArcGISImageServiceLayer.Initialized, AddressOf ArcGISImageServiceLayer_Intialized
                 
  ' Add the ArcGISImageServiceLayer to the LayerCollection of the Map.
  Map1.Layers.Add(myArcGISImageServiceLayer)
                 
End Sub
                 
Private Sub ArcGISImageServiceLayer_Intialized(ByVal sender As Object, ByVal e As EventArgs)
                 
  ' The Map1 object (a Map object) and TextBlock_MeanValues (a TextBlock object) were defined previously in XAML.
                 
  ' Access a specific ArcGISImageServiceLayer.
  Dim myArcGISImageServiceLayer As ESRI.ArcGIS.Client.ArcGISImageServiceLayer = Map1.Layers.Item(0)
  
  ' MeanValues (Read Only)
  Dim myMeanValues() As System.Double = myArcGISImageServiceLayer.MeanValues
  If myMeanValues IsNot Nothing Then
    Dim myMeanValuesText As String = "Num MeanValues: " + myMeanValues.Length.ToString
    Dim myMeanValuesText2 As String = ""
    Dim i2 As Integer
    For i2 = 0 To myMeanValues.Length - 1
      myMeanValuesText2 = myMeanValuesText2 + " " + myMeanValues(i2).ToString
    Next
    TextBlock_MeanValues.Text = myMeanValuesText + ". MeanValues: " + myMeanValuesText2
  Else
    TextBlock_MeanValues.Text = "[NO MeanValues SET]"
  End If
                 
End Sub

Remarks

Images are made up of one or more bands. Each band has a single measurable characteristic (such as temperature, elevation, electromagnetic spectrum value, etc.) per pixel. Depending on how the statistics are created for the ArcGISImageServiceLayer the NoData value may or may not be included in the calculation of the mean for each band. Contact the author of the ArcGISImageServiceLayer to determine how the statistics were created.

Theoretical information related to imagery can be found for the following topics:

Requirements

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

See Also

© ESRI, Inc. All Rights Reserved.