Baidu map Silverlight and flex (via Supermap iclient)

Source: Internet
Author: User

Demo:( Tip: Click the outer ring of the compass in the upper left corner to rotate the map. Double-click it to restore the normal North Point .)
Http://liongg.github.com/maps/bmsl.html(Silverlight)Http://liongg.github.com/maps/bmflex.html(Flex)

Baidu map currently only has the Javascript version, and does not have the FLEX, Silverlight, and other versions. Supermap iclient products support Google Maps, OSM, QQ maps, and other Web mocato projection and Its tile organization map, baidu map is a relatively unique projection and tile organization method, and there is no known solution. Out of curiosity, I tried to combine the two to create a mashup for play, an unofficial product.

The following briefly describes the idea of combining the two. The language is not detailed for retained, but not detailed. If you have a certain degree of understanding about both, the following ideas can be converted to the actualCode. If you do not understand it, it is useless to explain it in detail. In addition, we need to declare that the ideas here can be obtained from the public interfaces of the two. Of course, sometimes you have to hack some interfaces that are not included in the document but can actually be used.

According to the implementation interface provided by Supermap iclient, you need to know the map boundary range, scale (resolution or scale) array, and tile organization mode of Baidu map. Then you can use Baidu map data in Supermap iclient products.

Scale Array: In the Baidu API technology exchange group, Baidu map is 1 px at 18 levels, indicating 1 MB, that is, the spatial resolution is 1 MPP. (At the same time, it is also mentioned that Google maps at 18 levels is 1 px representing 0.8 m, but I think this value is not accurate.) If you accidentally miss the above valuable information, or you may have heard of it, but you can also get this value from the Baidu map's scale control ?), There is only a slight error, but this does not affect. Therefore, for a scaling level N, the resolution is math. Pow (-18 N) ppx.

Boundary range: First, you must be brave enough to discard Level 1-4 maps that basically have no value. Baidu does not provide data in other regions except China. You can also not discard it, but it will give it toAlgorithmThis greatly simplifies the process. Analyzed from a 5th-level map, consists of four rows and five columns of tiles. Combined with the Baidu map coordinate acquisition system, you can obtain the longitude and latitude values in the lower left corner of the map. You can convert the coordinates from hack to the projection coordinates through the Baidu map API. Based on the first step to obtain the scale data and the number of tiles, we can obtain the meter coordinate value in the "upper right corner. In this way, the boundary range of the map is reached. (Question: Why can't I directly obtain the value in the upper right corner by obtaining the coordinates in the lower left corner ?)

tile Organization : After a simple analysis of the Baidu tile URL format, the start point is (0, 0). For China, it is actually in the left-bottom direction. The Supermap iclient tile starts from the upper left point, so the two are converted accordingly. Sadly, the conversion constants at each level are different and must be calculated separately. Calculating the difference between a set of constants is the most complex step in the process.
first, there is such a small Program . Given a coordinate value, you can calculate the row and column numbers of the tiles at a specific level. (THINKING questions, how to complete this little tool? Tip: You need to use the hack to convert coordinates) to obtain the exact range of the tile, that is, the longitude and latitude value of the four sides.
second, with the preceding tool, the approximate value of the upper left corner of level 5th is obtained by using the map coordinate pick-up system, then, you can determine the exact longitude and latitude value in the upper left corner of level 5th. Precision is required, because when the level is very large, the error level 1 will be very far away.
3. determine the number of rows and columns in the upper left corner from Level 5 to level 18. The row and column number is the constant difference between the level and the Supermap iclient tile organization.

Final Statement: This article is only for research purposes and is not an official product. Although Baidu map and Supermap iclient are both free products, if you want to use them commercially, please contact the relevant company.

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.