Initializes a new ServiceLayer object and connects the layer to the specified ArcGIS Server image service URL.

Namespace:  ESRI.ArcGISExplorer.Mapping

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public static ServiceLayer OpenImageServer(
	Uri url
)
Visual Basic (Declaration)
Public Shared Function OpenImageServer ( _
	url As Uri _
) As ServiceLayer

Parameters

url
Type: System..::.Uri

A Uri object which represents a Uniform Resource Identifier and consists of a string used to identify the image service on the Internetm, consisting of the base URL and the service name.

Return Value

A ServiceLayer object connected to the specified ArcGIS Server image service.

Remarks

Use this method to both instantiate a ServiceLayer and connect the layer to an ArcGIS Server image service, using the full path of the image service. This overload is useful when you have a full URL to a service, for example from a website. In contrast to the Connect method, an exception will be thrown if the specified service cannot be accessed.

Version Information: This member is supported from version 2.0.0.1500.

Examples

The code below demonstrates how to both create and connect a ServiceLayer to an ArcGIS image service in a single call using the static OpenImageService method specifying the full URL of the image service. The new layer is then added as the first item in the Map, using the AddFirst method.
CopyC#
{
  try
  {
    // Create and connect to the Portland Cascade landsat image service on an ESRI sample server.
    ServiceLayer sl = ServiceLayer.OpenImageServer(
      new Uri(@"http://sampleserver3.arcgisonline.com/ArcGIS/services/Portland/CascadeLandsat"));

    //Add layer to the map
    ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.ChildItems.AddFirst(sl);
  }
  catch (ESRI.ArcGISExplorer.ConnectionException ex)
  {
    System.Diagnostics.Debug.Print(ex.Message);
  }
}
CopyVB.NET
Try
  ' Create and connect to the Portland Cascade landsat image service on an ESRI sample server.
  Dim sl As ServiceLayer = ServiceLayer.OpenImageServer( _
    New Uri("http://sampleserver3.arcgisonline.com/ArcGIS/services/Portland/CascadeLandsat"))

  ' Add layer to the map
  ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.ChildItems.AddFirst(sl)
Catch ex As ESRI.ArcGISExplorer.ConnectionException
  System.Diagnostics.Debug.Print(ex.Message)
End Try

Exceptions

ExceptionCondition
ESRI.ArcGISExplorer..::.ConnectionExceptionConnection failed. Check the Message and InnerException properties of the ConnectionException for more information about the reasons for the failure.

See Also