ArcGIS API for Silverlight - Library Reference
DynamicMapServiceLayer Class
Members  See Also  Send comments on this topic
ESRI.ArcGIS.Client Namespace : DynamicMapServiceLayer Class

Abstract dynamic map service layer class

Object Model

DynamicMapServiceLayer ClassEnvelope ClassSpatialReference ClassTimeExtent Class

Syntax

Visual Basic (Declaration) 
Public MustInherit Class DynamicMapServiceLayer 
   Inherits DynamicLayer
C# 
public abstract class DynamicMapServiceLayer : DynamicLayer 

Remarks

Implement this class if you want to create a custom dynamic layer where the generated image can be reached by a URL to a service of file hosted online. Note that if you want to manipulate the image, generate it on the client or manually handle download of the image you should instead implement DynamicLayer.

As a minimum this layer must implement GetUrl and set the Layer.FullExtent to the extent of the layer. The FullExtent should include a default SpatialReference for the layer. The map uses this to determine when to draw the layer.

When overriding Layer.Initialize you should always call base.Initialize(). If you require doing an asynchronous request (ie download metadata about the service), you should call base.Initialize() after the processing has completed. The Map wil not render the layer until Initialize has been called. If an error occurs in initialization set the Layer.InitializationFailure property with the exception and still call base.Initialize() afterwards.

Creating a dynamic layer using a simple map rendering webservice:

            public class MyLayer : DynamicMapServiceLayer
            {
              public override void Initialize()
              {
                this.FullExtent = new Envelope(-180,-90,180,80) { SpatialReference = new SpatialReference(4326) };
                this.SpatialReference = new SpatialReference(4326);
                base.Initialize();
              }
              public override void GetUrl(Envelope extent, int width, int height, OnUrlComplete onComplete)
              {
                if (extent.SpatialReference != null && extent.SpatialReference.WKID != 4326)
                  throw new NotSupportedException("SRID not supported");
                onComplete(string.Format(CultureInfo.InvariantCulture, "http://myserver/service.ashx?box={0},{1},{2},{3}&w={4}&h={5}",
                  extent.XMin, extent.YMin, extent.XMax, extent.YMax, width, height),
                  width, height, extent);
              }
            }
            

Inheritance Hierarchy

System.Object
   System.Windows.DependencyObject
      ESRI.ArcGIS.Client.Layer
         ESRI.ArcGIS.Client.DynamicLayer
            ESRI.ArcGIS.Client.DynamicMapServiceLayer
               ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer
               ESRI.ArcGIS.Client.ArcGISImageServiceLayer
               ESRI.ArcGIS.Client.Tasks.GPResultImageLayer
               ESRI.ArcGIS.Client.Toolkit.DataSources.WmsLayer

Requirements

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

See Also

© ESRI, Inc. All Rights Reserved.