Since Q1 2011 several changes were made to the RadMap improving it's functuonality - multiple providers added, support for culture settings to the map sources, own set of commands shown in every provider's CommandBar and etc. The RadMap provider architecture implemented in Q1 2011 release became not backwards-compatible with previous versions of the control. For RadMap's Custom Provider version 2011 Q1 and later, please refer to this blog post.  

Currently the RadMap control supports a few providers:

· Bing Maps

· OpenStreet Maps (also described in Vesselin’s blogpost)

· Empty Provider

This blogpost will demonstrate how to create a custom map provider. For the purposes of this example will create a provider for NAVTEQ. The approach is absolutely the same for any custom provider that fulfills the following requirements for the geographic location of tiles:

Each tile should have a pixel size of 256 x 256

· Tiles should cover a world map with a grid of the following ranges of geographical coordinates (because of the distortion around the poles caused by Mercator projection):

· - 85 to 85 latitude

· - 180 to 180 longitude.

· Tiles should cover a world map according to the deep zoom concept

· The width and height of whole map in tiles is calculated as 2 ^ zoom level. For example the zoom level 1 should contain 4 tiles. Zoom level 2 should contain 16 etc.

· Each tile has the fixed geographical location according to its zoom level and x-y position.For example when the zoom level is 1 and tilePositionX is 0 and tilePositionY is 0 then the real geographic location of the tile is 85, -180 (lat, lon).

The custom Map provider should inherit the MapProviderBase class and override the following properties and methods:


· MapProviderBase.IsInitialized (bool) - the value indicates whether map provider has been initialized. This is useful when you must make another call to get the required data for the provider before it is ready.

· MapProviderBase.IsLabelSupported (bool) - the value indicates that labels are supported by the map provider. It relates to the IsLabelVisible property that could be changed from UI controls of RadMap if the IsLabelSupported is true. For example the Bing Map provider supports the label visibility for aerial map mode.

· MapProviderBase.SpatialReference (ISpatialReference) - the spatial reference is used for calculating and converting geographical values inside the map control. Usually it is an instance of the MercatorProjection class. Mercator is the projection used by most online maps including Bing Maps, Open Street Maps and Yahoo etc.

· MapProviderBase.SupportedModes (IEnumerable<MapMode>) – The recommended approach is to change it for returning single mode for example MapMode.Road if your provider does not support multiple modes.


· MapProviderBase.Initialize() - it is called when the provider should be initialized. We recommend using it as is in the custom provider example below.

· bool IsModeSupported(MapMode mode) - returns true if given mode is supported. Returning true is reccomended always for single mode map provider.

· void OnMapModeChanged(MapMode oldMode, MapMode newMode) - called when the map mode is changed and it is used for initializing the provider. It calls the Initialize method in your custom provider.

· Uri GetTile(int tileLevel, int tilePositionX, int tilePositionY) - the method is used to return URI of a tile according to tile level (tile level 9 is equal zoom level 1), X (column index) and Y (row index) of tile for level's matrix. The size of level's matrix is (2 ^ zoom level, 2 ^ zoom level).

The NAVTEQ’s MapTP MGI Service is reached by HTTP GET request:

  2. public override Uri GetTile(int tileLevel, int tilePositionX, int tilePositionY)
  3. {
  4.     int zoomLevel = this.ConvertTileToZoomLevel(tileLevel);
  5.     string QuadKey = TileXYToQuadKey(tilePositionX, tilePositionY, zoomLevel);
  6.     string MapTPID = "YOUR MAPTPID HERE";
  7.     string url = "{navteqID}&quadkey={quad}";
  8.     url = ProtocolHelper.SetScheme(url);
  9.     url = url.Replace("{quad}", QuadKey);
  10.     url = url.Replace("{navteqID}", MapTPID);
  12.     return new Uri(url);
  13. }

Note: The given server URL ( is just an example. The actual server URL as well as the MAPTPID will be given to you when registering as a customer of Navteq MapTP products (hint: a 30 days Trial is available).

Voila the result:

Give it a try by downloading the sample code from here.

About the Author

Evgenia Milcheva

Front-End Developer
Telerik XAML Team

Related Posts


Comments are disabled in preview mode.