Providers Overview
The RadMap control doesn't display a map on itself, it needs a map provider from which to consume the required data. Currently the RadMap control supports a few providers:
It is now possible to specify multiple map providers that will be displayed one over another through the RadMap.Providers property. Note that in multiple providers scenario the first (master) provider should be tiled provider without geographic limits set. Also, providers that have geographic limits and use tiled map sources should be limited with the MapLayer.ZoomRange attached property. Zoom range should be set into the reasonable value, so the size of the “map window” does not get excessive on the maximum allowed zoom level; otherwise loading of the tiles into the window will dramatically decrease performance of the application.
Here is a list of the most important common properties shared by all map providers:
GeoBounds - Gets or sets region covered by map image (the region represented by map provider can be limited by geographic bounds now).
Opacity - Gets or sets the opacity factor for the respective provider imagery data.
Commands - Gets the collection of the commands supported by the respective provider. This is useful if you want to customize the default command list (i.e. add / remove commands). You can find more information here.
CommandBindingCollection - Gets collection of the command bindings.
SupportedSources - Gets the IDs of the supported sources. This property can be used in scenarios where it is necessary to get the list of supported sources and execute some action based on them (e.g. enable or disable source specific commands in the command bar).
Bing Maps
The Bing Maps can be used via the BingRestMapProvider (RESTful imagery service) class. In order to create an instance of the BingRestMapProvider you can use the third overload of its constructor. This way you can easily pass the required parameters - map mode, labels visibility and Bing Maps Key. The most important of them is the Bing Maps Key. Without supplying a valid key you won't be able to visualize the map inside the RadMap control. In order to learn how to obtain one, please read the Accessing the Control Using a Bing Maps Key MSDN article.
Example 1: RadMap with BingMapProvider
<telerik:RadMap x:Name="radMap" ZoomLevel="1">
<telerik:RadMap.Provider>
<telerik:BingRestMapProvider ApplicationId="Bing_Map_Key" Mode="Aerial" IsLabelVisible="True"/>
</telerik:RadMap.Provider>
</telerik:RadMap>
Example 2: BingMapProvider set in code
BingRestMapProvider bingMap = new BingRestMapProvider( MapMode.Aerial, true, "key" );
this.radMap.Provider = bingMap;
Dim bingMap As New BingRestMapProvider(MapMode.Aerial, True, "key")
Me.radMap.Provider = bingMap
Figure 1: Result from Examples 1 and 2
OpenStreet Maps
The Open Street Maps can be used via the OpenStreetMapProvider class. Since the R2 2019 version, you have the option of passing an API key to it. This key is needed for the Transport and Cycle maps, which come from ThunderForest. You can check the following page in order to learn how to obtain an API key.
Example 3: OpenStreetMapProvider with API key in Xaml
<telerik:RadMap x:Name="radMap" ZoomLevel="1">
<telerik:RadMap.Provider>
<telerik:OpenStreetMapProvider APIKey="your-api-key" />
</telerik:RadMap.Provider>
</telerik:RadMap>
Example 4: OpenStreetMapProvider set in code
OpenStreetMapProvider openStreetMap = new OpenStreetMapProvider("your-api-key");
this.radMap.Provider = openStreetMap;
Dim openStreetMap As New OpenStreetMapProvider("your-api-key")
Me.radMap.Provider = openStreetMap
Since the R1 2020 version, you have the option of passing a User-Agent header, which will be used in the web request for downloading the tiles from the Standard tile layer. This allows for compliance with the OpenStreetMaps Tile Usage Policy. Examples 5 and 6 demonstrate how you can pass such a User-Agent.
Example 5: Setting StandardModeUserAgent in Xaml
<telerik:RadMap x:Name="radMap" ZoomLevel="1">
<telerik:RadMap.Provider>
<telerik:OpenStreetMapProvider APIKey="your-api-key" StandardModeUserAgent="your custom user agent string" />
</telerik:RadMap.Provider>
</telerik:RadMap>
Example 6: Setting StandardModeUserAgent in code
OpenStreetMapProvider openStreeMapProvider = new OpenStreetMapProvider("your-api-key")
{
StandardModeUserAgent = "your custom user agent string"
};
Dim openStreeMapProvider As New OpenStreetMapProvider("your-api-key") With {.StandardModeUserAgent = "your custom user agent string"}
If a User-Agent is not provided, the Standard layer tiles will not be downloaded.
Empty Provider
Empty provider is a provider which doesn't connect to any real imagery services (Virtual Earth, Google etc). It provides definitions and methods which can be used to calculate positions of the framework elements, map shapes and pin points. By using this provider you can create map-relative applications which do not require visibility of the real map data (landscapes or roads), but which require visible elements to be positioned according to the geographical coordinates.
To learn more about the empty provider read here.
UriImageProvider
RadMap provides support for single image provider through the UriImageProvider class besides the built-in support for tiled (MultiScaleImage) providers like BingRestMapProvider and OpenStreetMapProvider. You can either use it with single image for all zoom levels, or you can specify an image for every distinct zoom level.
To learn more about the UriImageProvider read here.
ArcGIS online services
The ArcGIS online services can be used via the ArcGisMapProvider class. Currently the ArcGIS map provider support 6 modes which can be set using Mode property:
- Aerial
- Physical
- Shaded Relief
- Street
- Terrain
- Topographic
Example 7: Radmap with ArcGisMapProvider
<telerik:RadMap x:Name="radMap" ZoomLevel="1">
<telerik:RadMap.Provider>
<telerik:ArcGisMapProvider Mode="Physical" />
</telerik:RadMap.Provider>
</telerik:RadMap>
Example 8: ArcGisMapProvider set in code
ArcGisMapProvider provider = new ArcGisMapProvider();
provider.Mode = ArcGisMapMode.Physical;
this.radMap.Provider = provider;
Dim provider As New ArcGisMapProvider ()
provider.Mode = ArcGisMapMode.Physical
Me.radMap.Provider = provider