Research on the implementation of Bing Maps client based on Deepzoom technology

Source: Internet
Author: User
Tags instance method silverlight

The current web GIS client implementation based on Silverlight technology, including Microsoft Bing Maps Silverlight Control, and the open source Web GIS client Component Deepearth Project, The core is implemented by Deepzoom technology in Silverlight. You may already know that the Deepzoom technology is centered on the MultiScaleImage control, which has a source property of the Multiscaletilesource type that is used primarily to set the data source that the MultiScaleImage control will render. You can learn deep Zoom composer quickly by learning.

The deep Zoom composer creates a photo-based Silverlight project that generates a picture-viewing application based on the MultiScaleImage control, fully implements the image's tiling, and features such as smoothing, scaling, and dragging. In fact, the Web GIS client implementation based on Silverlight is also implemented by the MultiScaleImage control, the core of which is to use the Multiscaletilesource attribute to map tile data for different Web GIS maps (Image Tiles) provider to implement a data source for the MultiScaleImage control.

For Microsoft's Bing Maps, it is necessary to write a data source implementation for the MultiScaleImage control by understanding the Bing Maps Tile system and then publishing the map service for its image mapping system. You also need to capture the tiles path of the Bing maps using the HTTP Sniffer tool before implementing the following path format:

Street Map: http://r{0}.ortho.tiles.virtualearth.net/tiles/r{1}.png?g=203

Satellite map: http://h{0}.ortho.tiles.virtualearth.net/tiles/h{1}.jpeg?g=203

With the tiles path to the above Bing maps, you can then write the implementation of the data source for the MultiScaleImage control (both Multiscaletilesource) based on these two paths, the following block of code:

public abstract class BingMapsTileSource : MultiScaleTileSource
{
     protected BingMapsTileSource()
         : base(int.MaxValue, int.MaxValue, 0x100, 0x100, 0)
     { }
}

Through the code block above the Tilesource programming template can be seen, Bingmapstilesource inheritance and Deepzoom core class Multiscaletilesource, its loading picture The algorithm of the data is completed by the Multiscaletilesource instance method Gettilelayers (). So if you want to achieve the tiles path of the Bing maps that you obtained in front of you to get the map data for Bing Maps, you should rewrite the method's implementation to change the way it loads the data.

/// <summary>
/// 图层Tile算法
/// </summary>
/// <param name="tileLevel">缩放级别</param>
/// <param name="tilePositionX">X坐标</param>
/// <param name="tilePositionY">Y坐标</param>
/// <param name="tileImageLayerSources">图层源集合</param>
protected override void GetTileLayers(int tileLevel, int tilePositionX, int tilePositionY, IList<object>  tileImageLayerSources)
{
     int zoom = tileLevel - 8;
     if (zoom > 0)
     {
         string QuadKey = TileXYToQuadKey(tilePositionX, tilePositionY, zoom);
         string veLink = string.Format(UriFormat,new object[] { QuadKey[QuadKey.Length - 1], QuadKey  });
         var veUri = new Uri(veLink);
         tileImageLayerSources.Add(veUri);
     }
}

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.