随笔 - 19  文章 - 0  评论 - 82  阅读 - 14959

Arcgis api For silverlight 加载高德地图

地图仅供演示,研究使用。如要商用 请联系厂商。

复制代码
public class AMapLayer : 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 ESRI.ArcGIS.Client.Geometry.SpatialReference(102100);
            };


            this.SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100);

            this.TileInfo = new TileInfo()
            {
                Height = 256,
                Width = 256,

                Origin = new ESRI.ArcGIS.Client.Geometry.MapPoint(-20037508.342787, 20037508.342787)
                {
                    SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100)
                },
                Lods = new Lod[20]
            };


            double resolution = 156543.033928;

            for (int i = 0; i < TileInfo.Lods.Length; i++)
            {

                TileInfo.Lods[i] = new Lod() { Resolution = resolution };
                resolution /= 2;
            }

            // Call base initialize to raise the initialization event 
            base.Initialize();
        }

        public override string GetTileUrl(int level, int row, int col)
        {
            string baseUrl = "http://webrd0{0}.is.autonavi.com/appmaptile?x={1}&y={2}&z={3}&lang=zh_cn&size=1&scale=1&style=7"; ;

            string quard = GetQuard(col, row, level);

            return string.Format(baseUrl, (object)quard[quard.Length - 1], col, row, level);
        }

        public static string GetQuard(int x, int y, int zoomLevel)
        {
            string str = "";
            while (x > 0 || y > 0)
            {
                str = ((x & 1) << 1 | y & 1).ToString() + str;
                x >>= 1;
                y >>= 1;
            }
            return ((object)str).ToString().PadLeft(zoomLevel, '0');
        }
    }
复制代码
posted on   蔚蓝海  阅读(1709)  评论(1编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
< 2012年11月 >
28 29 30 31 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 1
2 3 4 5 6 7 8

点击右上角即可分享
微信分享提示