Implementing Custom Map in Silverlight Map Control

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

Few months ago I described shortly how to about how to integrate the custom map instead of the standard one provided by Silverlight Map control (released few days ago).

The code compatible with Map Control 1.0 is shown below:

// This removes standard Virtual Earth map.
// If you do not have this line of code, your custom map will be tailed over the
// standard one.


m_WorldMap.Mode = MercatorMode;

// Create a Tile Layer that will display our custom Map Imagery Tiles
var customTileLayer = new MapTileLayer();

// Create a LocationRectTileSource
LocationRectTileSource customTileSource = new LocationRectTileSource();

// Set the Uri for the custom Map Imagery Tiles c
customTileSource.UriFormat = uriFormat;

// Set the Min and Max Zoom Levels that the imagery is to be visible within
customTileSource.ZoomRange = 3;

// The bounding rectangle area that the tile overaly is valid in.
customTileSource.BoundingRectangle = boundingRect;

// Add the Tile Source to the Tile Layer
customTileLayer.TileSources.Add(customTileSource);

// Set the Tile Layer Opacity to a desired value
customTileLayer.Opacity = 1;

customTileLayer.BorderBrush = new SolidColorBrush(Colors.Blue);

In the code above I marked the variable uriFormat which is crucial one in this case. If you already have created custom map by using of CTP version of Map Control the uri fromat looks like:

http://www.daenet.eu/share/Maps/Cockpit/Layer_NewLayer/{0}.png

Unfortunately after installing of the release version of control you will notice that the map will just not appear. The reason is that the uri Format has been slightly changed now. After digging in reflector I figured out that following uri format will work now:

{UriScheme}://www.daenet.eu/share/Maps/Cockpit/Layer_NewLayer/{quadkey}.png

 

 

 



Posted Nov 16 2009, 11:43 PM by Damir Dobric

Comments

Implementing Custom Map in Silverlight Map Control - Damir Dobric … iSilverlight wrote Implementing Custom Map in Silverlight Map Control - Damir Dobric … iSilverlight
on 11-17-2009 13:49

Pingback from  Implementing Custom Map in Silverlight Map Control - Damir Dobric … iSilverlight

developers.de is a .Net Community Blog powered by daenet GmbH.