zoukankan      html  css  js  c++  java
  • 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');
            }
        }
  • 相关阅读:
    JavaWeb学习总结(二)——Tomcat服务器学习和使用(一)
    JavaWeb学习总结(一)——JavaWeb开发入门
    javaweb学习总结(四)——Http协议
    Eclipse中应用的调试
    Java Web快速入门——全十讲
    Spring 系列: Spring 框架简介
    分布式环境中三种Session管理方法的使用场景及优缺点
    Cookie/Session机制详解
    HTTP 协议详解
    Webx3学习笔记(2)——基本流程
  • 原文地址:https://www.cnblogs.com/thinkaspx/p/2767752.html
Copyright © 2011-2022 走看看