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"; // Control which individual bands are visible by setting the BandId's property. // In this example the ArcGISImageService has 4 bands available but only the 1st and 2nd bands will // be specified (Write) as visible. int[] myBandIds = { 0, 1 }; myArcGISImageServiceLayer.BandIds = myBandIds; // Create an Event Handler. myArcGISImageServiceLayer.Initialized += new System.EventHandler<EventArgs%gt;(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_BandIds (a TextBlock object) were defined previously in XAML. // Access a specific ArcGISImageServiceLayer. ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer = (ESRI.ArcGIS.Client.ArcGISImageServiceLayer)Map1.Layers[0]; // BandIds Property (Read/Write). // Use the getter (Read) to obtain an Integer Array of band ids that are visible. int[] myBandIds = myArcGISImageServiceLayer.BandIds; if (myBandIds != null) { // Specific BandIds have been set. string myBandIdsText = "Num BandIds: " + myBandIds.Length.ToString(); string myBandIdsText2 = ""; int i = 0; for (i = 0; i < myBandIds.Length; i++) { myBandIdsText2 = myBandIdsText2 + " " + myBandIds[i].ToString(); } // Display the number of BandIds set and which one. TextBlock_BandIds.Text = myBandIdsText + ". Bands: " + myBandIdsText2; } else { // Typically all of the bands are visible (turned on) by default in the ArcGIS Server service. // If the BandIds property is not set in the code-behind the getter (Read) will show the BandIds // coming back as Nothing/null. TextBlock_BandIds.Text = "[NO BandIds SET]"; } } |
VB.NET | Copy 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" ' Control which individual bands are visible by setting the BandId's property. ' In this example the ArcGISImageService has 4 bands available but only the 1st and 2nd bands will ' be specified (Write) as visible. Dim myBandIds() As Integer = {0, 1} myArcGISImageServiceLayer.BandIds = myBandIds ' 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_BandIds (a TextBlock object) were defined previously in XAML. ' Access a specific ArcGISImageServiceLayer. Dim myArcGISImageServiceLayer As ESRI.ArcGIS.Client.ArcGISImageServiceLayer = Map1.Layers.Item(0) ' BandIds Property (Read/Write). ' Use the getter (Read) to obtain an Integer Array of band ids that are visible. Dim myBandIds() As Integer = myArcGISImageServiceLayer.BandIds If myBandIds IsNot Nothing Then ' Specific BandIds have been set. Dim myBandIdsText As String = "Num BandIds: " + myBandIds.Length.ToString Dim myBandIdsText2 As String = "" Dim i As Integer For i = 0 To myBandIds.Length - 1 myBandIdsText2 = myBandIdsText2 + " " + myBandIds(i).ToString Next ' Display the number of BandIds set and which one. TextBlock_BandIds.Text = myBandIdsText + ". Bands: " + myBandIdsText2 Else ' Typically all of the bands are visible (turned on) by default in the ArcGIS Server service. ' If the BandIds property is not set in the code-behind the getter (Read) will show the BandIds ' coming back as Nothing/null. TextBlock_BandIds.Text = "[NO BandIds SET]" End If End Sub |
If there are multiple bands, you can either specify a single band to export, or you can change the band combination (red, green, blue) by specifying the band number, for example, [2, 1, 3].
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.
Typically all of the bands are visible (turned on) by default in the ArcGIS Server service. If the BandIds property is not set in the code-behind the getter (Read) will show the BandIds coming back as Nothing/null.
Theoretical information related to imagery can be found for the following topics:
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family