Currently RadMap supports three built-in map providers: Bing Maps, Open Street Maps and Empty provider. The empty provider does not show any map tiles. It just provides spatial reference (projection) for other operations (i.e. KML or ESRI shape files).
The Bing Maps and Open Street Map providers read their tile images from internet. Of course a browser can use these images from its cache, but the Bing Maps provider requires internet connection because it uses a WCF service to get URLs of the tile images.
It is a common scenario that the map tiles would be fetched offline from a corporate server instead of internet.
This blog post will demonstrate how to create your own tile server which fetches the tiles and runs on localhost.
It is quite simple to create a tile server on localhost when you have images which can be identified by the zoom level and (x,y) position of the tile.
All that you need to do is put your tiles(the downloaded images) in a separate directory in the C:\inetpub\wwwroot folder for example. So if you have the OpenStreet map tiles organized in a way similar to the structure on the OpenStreet servers (zoom\x_pos\y_pos.png) then you can create tile server on localhost in a couple of steps:
1. Create new folder like "os_images" in the "C:\inetpub\wwwroot" folder. 2. Copy the whole structure of the OpenStreet images to this new folder.
Here are some details about how to achieve this:
First you need to download and save locally the map images(tiles) that you need to show. For example, if you are using the Openstreet map provider there is an application called Easy OpenstreetMap Downloader that can be used to do this automatically for you. You can find instructions here.
Now you can create new map tile source and map provider which will access images from this folder:
Here is how to use the new map provider in your application:
The ConvertTileToZoomLevel method is inherited from TiledMapSource class so you don't need to bother about its implementation.
Note: Download and usage of the Bing map tiles besides the Bing services is illegal. It is prohibited by the Microsoft Bing license agreement and we discourage you from using it as sample offline provider. If you have some questions do not hesitate to drop us a line here or in the Forum threads.
Happy coding with our controls!
Telerik XAML Team