Arcgis api For silverlight 加载QQ地图

简介: 原文 http://www.cnblogs.com/thinkaspx/archive/2012/11/07/2759079.html //本篇博客仅在技术上探讨可行性    //如果要使用Q 地图,请联系相关厂商 public class QQMapLayer : TiledMapServi...

原文 http://www.cnblogs.com/thinkaspx/archive/2012/11/07/2759079.html

//本篇博客仅在技术上探讨可行性 

  //如果要使用Q 地图,请联系相关厂商

public class QQMapLayer : TiledMapServiceLayer { private const double cornerCoordinate = 20037508.342787; public override void Initialize() { this.FullExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787) { SpatialReference = new SpatialReference(102113) }; // This layer's spatial reference this.SpatialReference = new SpatialReference(102113); // Set up tile information. Each tile is 256x256px, 19 levels. this.TileInfo = new TileInfo() { Height = 256, Width = 256, Origin = new MapPoint(-cornerCoordinate, cornerCoordinate) { SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102113) }, Lods = new Lod[20] }; // Set the resolutions for each level. Each level is half the resolution of the previous one. double[] resolution = new double[] { 156543.033928, 78271.5169639999, 39135.7584820001, 19567.8792409999, 9783.93962049996, 4891.96981024998, 2445.98490512499, 1222.99245256249, 611.49622628138, 305.748113140558, 152.874056570411, 76.4370282850732, 38.2185141425366, 19.1092570712683, 9.55462853563415, 4.77731426794937, 2.38865713397468, 1.19432856685505, 0.597164283559817, 0.298582141647617 };//cornerCoordinate * 2 / 256;// for (int i = 0; i < TileInfo.Lods.Length; i++) { //TileInfo.Lods[i] = new Lod() { Resolution = Math.Pow(2, 18 - i) }; TileInfo.Lods[i] = new Lod() { Resolution = resolution[i] }; } // Call base initialize to raise the initialization event base.Initialize(); } private string[] _subDomains = new string[] { "p0", "p1", "p2", "p3" }; private int[] scope = new int[] { 0, 0, 0, 0, 0, 3, 0, 3, 0, 3, 0, 3, 0, 7, 0, 7, 0, 15, 0, 15, 0, 31, 0, 31, 0, 63, 4, 59, 0, 127, 12, 115, 0, 225, 28, 227, 356, 455, 150, 259, 720, 899, 320, 469, 1440, 1799, 650, 929, 2880, 3589, 1200, 2069, 5760, 7179, 2550, 3709, 11520, 14349, 5100, 7999, 23060, 28689, 10710, 15429, 46120, 57369, 20290, 29849, 89990, 124729, 41430, 60689, 184228, 229827, 84169, 128886 }; public override string GetTileUrl(int level, int row, int col) { var subdomain = this._subDomains[(level + col + row) % this._subDomains.Length]; string baseUrl = "http://{0}.map.qq.com/maptiles/{1}"; // var f = level * 4; if (f == this.scope.Length) return ""; var i = this.scope[f++]; var j = this.scope[f++]; var l = this.scope[f++]; var scope = this.scope[f]; var tileNo = ""; if (col >= i && col <= j && row >= l && row <= scope) { row = (int)(Math.Pow(2, level) - 1 - row); tileNo = level + "/" + Math.Floor(col / 16) + "/" + Math.Floor(row / 16) + "/" + col + "_" + row + ".png"; } return string.Format(baseUrl, subdomain, tileNo); } }
目录
相关文章
|
人工智能 数据可视化 API
ArcGIS API for Python
ArcGIS API for Python
73 0
|
JavaScript 前端开发 应用服务中间件
Arcgis api for javascript 详细部署
Arcgis api for javascript 详细部署
|
人工智能 数据可视化 数据管理
ArcGIS API for Python
ArcGIS API for Python
120 0