Visual Basic (Declaration) | |
---|---|
Public Property CompressionQuality As Nullable(Of Integer) |
C# | |
---|---|
public Nullable<int> CompressionQuality {get; set;} |
XAML | Copy Code |
---|---|
<esri:Map Name="Map1" Height="400" Width="400" "> <!-- CompressionQuality Property (Read/Write). --> <esri:ArcGISImageServiceLayer Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer" CompressionQuality="50"/> </esri:Map> <TextBlock Name="TextBlock_CompressionQuality" Height="23" Width="248" Text="{Binding ElementName=Map1, Path=Layers[0].CompressionQuality}"/> |
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"; // In this example the CompressionQuality will be set to 50. Nullable<int> myCompressionQuality = 50; myArcGISImageServiceLayer.CompressionQuality = myCompressionQuality; // 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_CompressionQuality (a TextBlock object) were defined previously in XAML. // Access a specific ArcGISImageServiceLayer. ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer = (ESRI.ArcGIS.Client.ArcGISImageServiceLayer)Map1.Layers[0]; // CompressionQuality Property (Read/Write). // The return Type can be null/Nothing or an Integer. // Use the getter (Read) to obtain the CompressionQuality. Nullable<int> myCompressionQuality = myArcGISImageServiceLayer.CompressionQuality; if (myCompressionQuality != null) { // Display the custom set CompressionQuality value. TextBlock_CompressionQuality.Text = myArcGISImageServiceLayer.CompressionQuality.ToString(); } else { // The default CompressionQuality is 75 in the ArcGIS Server service. // If the CompressionQuality property is not set in the code-behind or XAML the getter (Read) will show the // CompressionQuality coming back as Nothing/null. TextBlock_CompressionQuality.Text = "[NO CompressionQuality 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" ' In this example the CompressionQuality will be set to 50. Dim myCompressionQuality As Nullable(Of Integer) = 50 myArcGISImageServiceLayer.CompressionQuality = myCompressionQuality ' 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_CompressionQuality (a TextBlock object) were defined previously in XAML. ' Access a specific ArcGISImageServiceLayer. Dim myArcGISImageServiceLayer As ESRI.ArcGIS.Client.ArcGISImageServiceLayer = Map1.Layers.Item(0) ' CompressionQuality Property (Read/Write). ' The return Type can be null/Nothing or an Integer. ' Use the getter (Read) to obtain the CompressionQuality. Dim myCompressionQuality As Nullable(Of Integer) = myArcGISImageServiceLayer.CompressionQuality If myCompressionQuality IsNot Nothing Then ' Display the custom set CompressionQuality value. TextBlock_CompressionQuality.Text = myArcGISImageServiceLayer.CompressionQuality.ToString Else ' The default CompressionQuality is 75 in the ArcGIS Server service. ' If the CompressionQuality property is not set in the code-behind or XAML the getter (Read) will show the ' CompressionQuality coming back as Nothing/null. TextBlock_CompressionQuality.Text = "[NO CompressionQuality SET]" End If End Sub |
The default compression quality is 75. Compression only applies to lossy image types such as JPEG (JPG). PNG is considered a lossless data compression and the CompressionQuality has no effect. If the CompressionQuality property is not set in the code-behind or XAML the getter (Read) will show the CompressionQuality property coming back as Nothing/null.
Support for the JPGPNG format was added at ArcGIS Server 10.0. This format returns a JPG if there are no transparent pixels in the requested extent, otherwise it returns a PNG.
Theoretical information related to compression types can be found for the following topics:
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family