Visual Basic (Declaration) | |
---|---|
Public Class ArcGISTiledMapServiceLayer Inherits TiledMapServiceLayer Implements IAttribution, ILegendSupport, ISublayerVisibilitySupport, ITileCache |
C# | |
---|---|
public class ArcGISTiledMapServiceLayer : TiledMapServiceLayer, IAttribution, ILegendSupport, ISublayerVisibilitySupport, ITileCache |
Allows you to work with a cached map service resource exposed by the ArcGIS Server REST API (available in ArcGIS Server 9.3 and above). A cached service accesses pre-created tiles from a cache instead of dynamically rendering images.
The projection of the Map is determined by the first visible layer with a ESRI.ArcGIS.Client.Geometry.SpatialReference defined. If the ESRI.ArcGIS.Client.Geometry.SpatialReference of the Map is different than a Tiled Layer, the Tiled Layer will not be displayed.
XAML usage of ArcGISTiledMapServiceLayer:
<esri:Map>
<esri:ArcGISTiledMapServiceLayer ID="MyTiledLayer"
Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
</esri:Map>
A call to the ArcGISTiledMapServiceLayer is Asynchronous. As a result, this means that you cannot obtain valid Read (VB.NET) or get (C#) Property values until information has been returned from ArcGIS Server to the Client application. You can safely obtain valid Read/get Property information in the Initialized, LegendChanged, PropertyChanged, TileLoaded, and TileLoading Events or from a function/sub/method that occurs after these Events fire. If you try to obtain Read/get Property information before these Events fire you will obtain invalid or null/Nothing information for the particular Property in question.
Distributing load to multiple domains or servers:
By default most browsers only make two requests to a single domain at a time. This can adversely impact the amount of time it takes to load a lot of image tiles from the same server. To resolve this you can configure your ArcGIS REST web server to work on multiple subdomains or host the ArcGIS REST web services on multiple web servers. This will enable the browser to overcome the two-requests-per-domain limitation. From SL version 2.2, the ArcGISTiledMapServiceLayer supports multiple subdomains provided that the map service supports it as well (arcgis.com or ArcGIS server from version 10.1 supports it). With previous versions, the ArcGISTiledMapServiceLayer does not support multiple subdomains, but it can easily be extended to support it by creating a subclass and overriding the GetTileUrl method. In the example below this is accomplished by replacing the leading "http://www." with several subdomains.
public class MultiDomainArcGISTiledMapServiceLayer : ArcGISTiledMapServiceLayer
{
private static string[] subDomains = { "http://sub1.","http://sub2.","http://sub3." };
public override string GetTileUrl(int level, int row, int col)
{
// Select a subdomain based on level/row/column so that it will always
// be the same for a specific tile. Multiple subdomains allow the user
// to load more tiles simultanously. To take advantage of the browser cache
// the following expression also makes sure that a specific tile will always
// hit the same subdomain.
string subdomain = subDomains[(level + col + row) % subDomains.Length];
string url = base.GetTileUrl(level, row, col);
return url.Replace("http://www.", subdomain);
}
}
System.Object
System.Windows.DependencyObject
ESRI.ArcGIS.Client.Layer
ESRI.ArcGIS.Client.TiledLayer
ESRI.ArcGIS.Client.TiledMapServiceLayer
ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer
Target Platforms: Windows Vista, Windows 7