博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Arcgis api For silverlight 加载QQ地图
阅读量:7096 次
发布时间:2019-06-28

本文共 3508 字,大约阅读时间需要 11 分钟。

原文

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

  //如果要使用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);        }    }

转载地址:http://odxql.baihongyu.com/

你可能感兴趣的文章
阿里云服务器部署LAMP
查看>>
使用jMeter构造大量并发的随机HTTP请求
查看>>
做一个帮你快速调试UI参数的Android插件
查看>>
经典的 Top K 问题,你真的懂了么?
查看>>
ionic3 相机和相册获取图片
查看>>
JavaScript 基础(2)- 操作符、字符串、数组
查看>>
Spark log4j 日志配置详解
查看>>
Java学习:JVM是什么?
查看>>
深度解析国内首个云原生数据库POLARDB的“王者荣耀”
查看>>
常见乱码问题分析和总结
查看>>
Spring MVC 源码解析(二)— 容器初始化
查看>>
Android NDK开发之旅8 C语言基础 预编译
查看>>
iOS的 gRPC 之路
查看>>
【译】Swift算法俱乐部-二分搜索
查看>>
Android面试题(三)
查看>>
Android 重识MVP 你应该知道的写法
查看>>
ionic2 中使用iconfont
查看>>
Redis命令详解:String
查看>>
使用css的伪类给html代码块添加代码种类
查看>>
小程序实战踩坑之B2B商城项目总结
查看>>