TIPS: loads other maps in Bing Maps Silverlight control, such as Google satellite maps and Yahoo Maps. From time to time in the past year, Microsoft and Google were both superior and inferior. The MSN signature of the day before yesterday was also changed to enterprise Microsoft vs consumer Google, which basically represented its own conclusion. In general, the two are both great companies. What is great is not just the simplicity of their products and technologies, microsoft and Google represent the people, technology, culture, ecological chain, and social impact behind them. In contrast, Microsoft operates the market with the idea of being an enterprise customer, while Google is more like an Internet company and closer to end users. Therefore, Google has won more praise. However, it is still early to think that there is a better future, because companies like Microsoft and Google are not only affected by products, technologies, users, but also investors behind them. The introduction is so long that Microsoft Bing Maps and Google Maps, the two most influential online maps in the world, each have their own advantages. For example, in China, Google provides a satellite map with a good resolution (the reason for this is that Microsoft provides a satellite map with a resolution of up to 0.35, google provides a maximum resolution of 1 m in China), and Microsoft has not provided satellite maps on the domestic Bing map platform for some reasons. However, Microsoft has launched the Silverlight map control globally, which has won praise from many users. As a result, many users, including me, have considered whether the Global Map and Chinese road map can be displayed in the Microsoft Bing map Silverlight control, and it is better to display Google satellite maps. This article aims to achieve this goal. As usual is the preparation, want to understand the content of this article, you need to understand the first few articles, at least how much to understand the development of Silverlight map controls: 1) https://sharepoint.connect.microsoft.com/silverlightmapcontrolctp/iSDK/default.htm Bing map Silverlight online interactive SDK
2) http://acnchen.spaces.live.com/blog/cns! 9321da57338f36ba! 3231. Entry Bing map Silverlight controls some references 3) http://acnchen.spaces.live.com/blog/cns! 9321da57338f36ba! 3241. Entry Bing map Silverlight control development entry 4) http://acnchen.spaces.live.com/blog/cns! 9321da57338f36ba! 3428. Entry Bing map tile system principle and load custom layers 5) http://acnchen.spaces.live.com/blog/cns! 9321da57338f36ba! 3430. entry: I used the Bing map Silverlight control to load map of China (5th). We know that loading other maps on the Silverlight control of the Bing map is nothing more than specifying a target map as a custom layer. Let's briefly review how to load the Bing China Map on the Bing map Silverlight control. The basic steps are as follows: 1. Create an instance of the maptilelayer object. 2. Create an instance of the tile source object. 3. Add the instance of the tile source object to the maptilelayer instance. 4. Add the maptilelayer instance to the map., in that article, I mainly modified tilesourceuri in the official example of the Bing map Silverlight control, that is:Uribuilder tilesourceuri = New uribuilder ("Http://r3.tiles.ditu.live.com/tiles/%0%.png? G = 47");The main function of this Code is to convert the URL of the Bing map image to the tile source URI format recognized by the Silverlight control. In essence, dynamically attaching online map images to Bing Maps as custom layers is actually sending an HTTP request to the online map to download the images and then adding them to the client. Therefore, we need to consider how to construct this HTTP request. For the Bing map Silverlight control application client, the X and Y coordinates and the current zoom level Z (zoom level) can be obtained ). So how do we know the URL format of Google satellite map? The omnipotent httpwatch is on the stage again, so we can easily analyze its format as follows: http: // KHM {0} .google.com/kh/v?47&x={1}&y=%2}&z=%3}. The remaining work is simple, reload the tile source object and declare a googletilesource class:Public class googletilesource: tilesource
{
Public googletilesource ()
: Base ("Http: // KHM {0} .google.com/kh/v?47&x==1}&y=%2}&z=%3}")
{
}Public override URI geturi (int x, int y, int zoomlevel)
{
Return new uri (string. Format (this. uriformat, X % 4, X, Y, zoomlevel ));
}
}Then add the custom layer according to the four steps described above:Public maptilelayer customtilelayer = new maptilelayer (); // create a maptilelayer object instance
Public googletilesource gtilesource = new googletilesource (); // create a tile source object instanceCustomtilelayer. tilesources. Add (gtilesource); // Add tile source to maptilelayer
Mymap. Children. Add (customtilelayer); // Add maptilelayer to mapIn this way, we can overlay and display Google satellite images in the Silverlight control of the Bing map. You can also add two buttons to control the display of Bing map's Chinese road map and Google satellite map. The following two demos are provided to show the Bilingual road map provided by OpenStreetMap and Google's satellite map: