Visual Basic (Declaration) | |
---|---|
Public Property NoData As Nullable(Of Double) |
C# | |
---|---|
public Nullable<double> NoData {get; set;} |
The data type for the NoData Property is a Nullable double. This means that if the NoData Property has not been set then the return value will come back as Nothing/null. If the NoData Property has been set the the return type will come back at a double.
Setting the NoData Property to a valid pixel value will return an image where the NoData pixel values are displayed as transparent. Transparent pixels can only be displayed when using lossless compression types. Since the default ArcGISImageServiceLayer.ImageFormat is set to JPG, transparent pixel values will not be displayed when the NoData Property value is set. To display transparent pixels by setting the NoData Property, first set the ArcGISImageServiceLayer.ImageFormat Property to either PNG8, PNG24, or JPGPNG.
JPG is considered a lossy image type. PNG is considered lossless image types. Theoretical information related to these compression types can be found for the following topics:
XAML | ![]() |
---|---|
<esri:Map Name="Map1" Height="400" Width="400" "> <!-- NoData Property. --> <esri:ArcGISImageServiceLayer Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer" NoData="0"/> </esri:Map> <TextBlock Name="TextBlock_NoData" Height="23" Width="248" Text="{Binding ElementName=Map1, Path=Layers[0].NoData}"/> |
C# | ![]() |
---|---|
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/Earthquakes/CaliforniaDEM/ImageServer"; // Set the ImageFormat to PNG24 (lossless) so that Transparent (NoData) pixels can be shown. myArcGISImageServiceLayer.ImageFormat = ESRI.ArcGIS.Client.ArcGISImageServiceLayer.ImageServiceImageFormat.PNG24; // Set the NoData pixel value to 0. Nullable<double> myNoData2 = 0; //double? myNoData2 = 0; // An alternative way to declare and use Nullable Types. myArcGISImageServiceLayer.NoData = myNoData2; // 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_NoData (a TextBlock object) were defined previously in XAML. // Access a specific ArcGISImageServiceLayer. ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer = (ESRI.ArcGIS.Client.ArcGISImageServiceLayer)Map1.Layers[0]; // The return Type can be null/Nothing or an Integer Nullable<double> myNoData = myArcGISImageServiceLayer.NoData; if (myNoData != null) { TextBlock_NoData.Text = myArcGISImageServiceLayer.NoData.ToString(); } else { TextBlock_NoData.Text = "[NO NoData SET]"; } } |
VB.NET | ![]() |
---|---|
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/Earthquakes/CaliforniaDEM/ImageServer" ' Set the ImageFormat to PNG24 (lossless) so that Transparent (NoData) pixels can be shown. myArcGISImageServiceLayer.ImageFormat = ESRI.ArcGIS.Client.ArcGISImageServiceLayer.ImageServiceImageFormat.PNG24 ' Set the NoData pixel value to 0. Dim myNoData As Nullable(Of Double) = 0 'Dim myNoData? As Double = 0 ' An alternative way to declare and use Nullable Types. myArcGISImageServiceLayer.NoData = myNoData ' 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_NoData (a TextBlock object) were defined previously in XAML. ' Access a specific ArcGISImageServiceLayer. Dim myArcGISImageServiceLayer As ESRI.ArcGIS.Client.ArcGISImageServiceLayer = Map1.Layers.Item(0) 'The return Type can be null/Nothing or an Integer Dim myNoData As Nullable(Of Double) = myArcGISImageServiceLayer.NoData If myNoData IsNot Nothing Then TextBlock_NoData.Text = myArcGISImageServiceLayer.NoData.ToString Else TextBlock_NoData.Text = "[NO NoData SET]" End If End Sub |
Target Platforms:Windows Phone 7