Bing map development introductory lecture 19: loading satellite maps on Bing map China Platform

Source: Internet
Author: User

 

Countless times, I had to explain to clients why Microsoft Bing Maps's China platform (http://ditu.bing.com) has no satellite maps while the Global Platform (http://maps.bing.com) has, and why Google maps have. In fact, the reason is very simple. China's map laws do not explicitly stipulate that satellite maps can be published in China. I often tell you a logic, that is, in China, we can only do what the law permits, while in foreign countries, we can do things that the law does not stipulate. Microsoft is a conservative company, so we are cautious in following national laws and regulations. Of course, this article is classified as "getting started with development", obviously not to explain the above content. In this article, I will introduce how to overlay a satellite map on the global Bing map platform on the map of China. The following are some reference articles to help us implement the solutions required in this article: 1) Explain) usage of the comment source attribute, which is very important 3) http://msdn.microsoft.com/en-us/library/bb545006.aspx. go to step 1 to introduce the tile System, we need to overlay the satellite map of Bing maps as a custom layer on the Bing map China platform; 4) The last is a small tool, that is, httpwatch. Note that Microsoft does not recommend the solution described in this article, that is, directly accessing tile system. Because Microsoft may change the server path at any time.In view of the company's system, I try my best to summarize the information that Microsoft has published and discuss the solution in this article from the perspective of a map enthusiast to avoid leaking some core content. Next we will analyze how to load a satellite map on the Bing map step by step. Here we first use a method: vemap. addtilelayer (layersource, visibleonload); this method is simple and easy to understand. The key lies in the input parameter layersource, which is a vetilesourcespecification class, tilesource, the most important attribute of this class, is used to specify the source of the custom image. What we need to do is to use a satellite map as the tilesource. Next we use httpwatch, a small example of any Bing map (access to the Global Platform), found that Bing MAP satellite image request URL format is roughly as follows: http://t0.tiles.virtualearth.net/tiles/a13212.png? G = 213 back to references 2) and 3), tilesource-the tile source contains a URL that points to the servers that are going to host the tiles. there are three place holder variables within this URL.
  • % 1-this parameter is a place holder for map style. if the tile images start with 'A', 'R', or 'h', and the source URL contains % 1, the map only displays tiles if the view style matches the image names. if this parameter is omitted, then tiles are displayed on every view type.
  • % 2-this parameter is a place holder for the server number if there is more than one server. use this place holder if the tiles are hosted on multiple severs (numbered sequentially ). bing Maps will make requests to each server in a round-robin fashion.
  • % 4-the last parameter is a place holder for the default Bing Maps numbering scheme. Use this if the custom tiles follow the Bing Maps numbering scheme.

If you find it hard to understand the English section above, I will tell you that when setting Bing Maps satellite photos as a custom layer tilesource, you only need the following code:

VaR tilesourcespec = new vetilesourcespecification ("China", "http://t0.tiles.virtualearth.net/tiles/a%4.png? G = 213 "); or:

VaR tilesourcespec = new vetilesourcespecification ("China", "http: // T % 2.tiles.virtualearth.net/tiles/a%4.png? G = 213 "). In this form, you can access multiple map servers.

In the specific code, a00004.png, where a represents the first letter of the satellite image (aerial). When you want to call a road map, you can change A to R.

So far, we can add satellite images on Bing Maps to bing DITU. The Code is as follows:

Function gettiles ()
{

VaR tilesourcespec = new vetilesourcespecification ("China", "http: // T % 2.tiles.virtualearth.net/tiles/a%4.png? G = 213 ");
Tilesourcespec. numservers = 2;
Tilesourcespec. bounds = NULL;
Tilesourcespec. minzoomlevel = 1;
Tilesourcespec. maxzoomlevel = 17;
Tilesourcespec. Opacity = 1;
Tilesourcespec. zindex = 900;

Map. addtilelayer (tilesourcespec, true );
}

I will not write the complete code. If I can understand this article, I must have studied Bing map and I should know how to implement it. As you can see, savvy friends have begun to think about it. This method can be applied to Microsoft's Bing map Silverlight map control. Because the Bing map Silverlight control can only display English maps, we can use the solution in this article to overlay the Chinese road images of Bing map on the English map. Let's just give your homework assignments. I will announce the answers in a few days.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.