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.

The UriImageProvider is suitable for showing images of city areas or cities. It is not designed to handle big geographical spaces (such as entire countries or continents) as this may result in a considerably big size of the created images which may cause an OutOfMemoryException on some machines.

Assuming that images with names osm_10.png, osm_11.png, ..., osm_14.png are embedded as resources within the application assembly, you can initialize the UriImageProvider like this:

<telerik:RadMap x:Name="RadMap1"  
                ZoomLevel="13"  
                MinZoomLevel="10"  
                MaxZoomLevel="14"  
                Center="42.72481708629, 23.3176519378416" 
                NavigationVisibility="Collapsed" 
                ZoomBarVisibility="Collapsed" 
                CommandBarVisibility="Collapsed"> 
    <telerik:RadMap.Provider> 
        <telerik:UriImageProvider GeoBounds="42.786, 23.17, 25, 14" Uri="/MyApplication;component/osm_{zoom}.png" /> 
    </telerik:RadMap.Provider> 
</telerik:RadMap> 

The UriImageProvider provides support for the following specific properties:

  • Uri: Gets or sets the uniform resource identifier (URI) for the image location.

Example: http://c.tile.openstreetmap.org/7/70/43.png (© OpenStreetMap contributors). Silverlight RadMap Example Tile

In a Silverlight application this can either point to absolute location (like the above example) or it can be the relative path to the image e.g. Uri="/7/70/43.png" that is combined with the value of the BaseAddress property.

If you have separate image for every zoom level then the URI string must contain {zoom} placeholder. This part will be replaced with the actual zoom level when the image is requested (e.g."/MyApplication;component/MapImages/image_{zoom}.png").

  • BaseAddress: Gets or sets the uniform resource identifier (URI) of the base address for the image location. In Silverlight the default value of this property points to the root of the HTML document on which the Silverlight plug-in is hosted (i.e. the web application root) and most probably you would not need to change this value.

  • ZoomNumericFormat: Gets or sets numeric format string will be used to replace {zoom} placeholder. For example "D2" will replace {zoom} placeholder with 2 digits integer (01, 02, ..., 19). The default value is null and it produces simple integer without paddings (1, 2, ... 9, 10, ... 19).

Note that the UriImageProvider cannot be used as a master provider in a multi-provider scenario and always should be restricted within geographic region (i.e. you need to set the UriImageProvider.GeoBounds property).

In this article