The map provider architecture implemented in Q1 2011 release is not backwards-compatible with previous versions of the control.
Here is a list of all provider-related changes:
- The IMapProvider interface no longer exists.
- The MapProviderBase class exists but it should not be used as a base class for custom providers any more.
- All custom map providers should inherit either from TiledProvider, or ImageProvider.
- TiledProvider is a base class for map providers that show map as a sequence of tiles (e.g. BingMaps, OpenStreetMap).
- ImageProvider is a base class for providers that show map as a single image (UriImageProvider).
- Since all existing custom providers (prior to Q1 2011) show map as a sequence of tiles, they should be changed to inherit from the TiledProvider class. The only property which must be overridden in these custom providers is SpatialReference -- it should return the actual projection used by the provider (in all existing custom providers prior to Q1 2011 it should be MercatorProjection).
Here is a list of all map source-related changes:
- The map provider cannot be used as a map source by itself as it was allowed before.
- The logic which provides tiles must be moved to separate class – map source.
- All map source classes should inherit either from TiledMapSource, or ImageMapSource classes and override methods depending on the specific map source type.
- TiledMapSource is a base class for map sources that return map tiles (that includes all BingMaps sources: aerial, road, birds eye, and all OpensStreetMap sources: Mapnik and Osmarenderer)
- ImageMapSource is a base class for map sources that return single map image.
- Since all existing providers prior to Q1 2011 show map as a sequence of tiles, their new map source classes should inherit from the TiledMapSource class and meet the following requirements:
- Override the Initialize method.
- Override the GetTile method and existing custom logic should be moved here.
- Call RaiseInitializeCompleted method when the respective custom provider is initialized (in case of simple providers it is enough to call this method from the override Initialize method).
Simple map provider that supports one map source can be as simple as following:
public class MyMapProvider : TiledProvider
MyMapSource source = new MyMapSource();
public override ISpatialReference SpatialReference
return new MercatorProjection();
public class MyMapSource : TiledMapSource
: base(1, 20, 256, 256)
public override void Initialize()
protected override Uri GetTile(int tileLevel, int tilePositionX, int tilePositionY)
int zoomLevel = ConvertTileToZoomLevel(tileLevel);
string url = CustomHelper.GetTileUrl(tileLevel, tilePositionX, tilePositionY);
return new Uri(url);
Public Class MyMapProvider
Public Sub New()
Dim source As New MyMapSource()
Public Overrides ReadOnly Property SpatialReference() As ISpatialReference
Return New MercatorProjection()
Public Class MyMapSource
Public Sub New()
MyBase.New(1, 20, 256, 256)
Public Overrides Sub Initialize()
Protected Overrides Function GetTile(tileLevel As Integer, tilePositionX As Integer, tilePositionY As Integer) As Uri
Dim zoomLevel As Integer = ConvertTileToZoomLevel(tileLevel)
Dim url As String = CustomHelper.GetTileUrl(tileLevel, tilePositionX, tilePositionY)
Return New Uri(url)