百度地图、Google地图的缩放比例

百度地图、Google地图的缩放比例_第1张图片


1、百度

百度内容转自:http://blog.csdn.net/mnorst/article/details/12975413#comments

百度地图、Google地图的缩放比例_第2张图片

        ///  通过缩放级别获取百度地图的缩放比例。
        /// 
        public static double GetScale(int zoom)
        {
            switch (zoom)
            {
                case 1: return 131072;
                case 2: return 65536;
                case 3: return 32768;
                case 4: return 16384;
                case 5: return 8192;
                case 6: return 4096;
                case 7: return 2048;
                case 8: return 1024;
                case 9: return 512;
                case 10: return 256;
                case 11: return 128;
                case 12: return 64;
                case 13: return 32;
                case 14: return 16;
                case 15: return 8;
                case 16: return 4;
                case 17: return 2;
                case 18: return 1;
            }
            return 1;
        }


2、谷歌

        ///  通过缩放级别获取Google地图的缩放比例。
        /// 
        public static double GetScale(int zoom)
        {
            #region Google map (in meters/pixel) 的比例值。scale =π R / (256 * 2^(z-1)),π = 3.1415926536, R = 6378137(地球半径)。

            switch (zoom)
            {
                case 0: return 156543.03392;
                case 1: return 78271.51696;
                case 2: return 39135.75848;
                case 3: return 19567.87924;
                case 4: return 9783.93962;
                case 5: return 4891.96981;
                case 6: return 2445.98490;
                case 7: return 1222.99245;
                case 8: return 611.49622;
                case 9: return 305.74811;
                case 10: return 152.87405;
                case 11: return 76.43702;
                case 12: return 38.21851;
                case 13: return 19.10925;
                case 14: return 9.55462;
                case 15: return 4.77731;
                case 16: return 2.38865;
                case 17: return 1.19432;
                case 18: return 0.59716;
                case 19: return 0.29858;
                default: return 19.10925;//默认的话按13算
            }

            #endregion       
        }


你可能感兴趣的:(silverlight,NET,WPF)