Exemplo n.º 1
0
        public ulong EncodeLngLat(double lat, double lng)
        {
            var morton = new Morton2D();
            var L      = EncodeLngLat(lng);
            var B      = EncodeLngLat(lat);

            return(morton.Magicbits(L, B));
        }
Exemplo n.º 2
0
        public void DecodeLngLat(ulong code, ref double lat, ref double lng)
        {
            var  morton = new Morton2D();
            uint L      = 0; // 横轴
            uint B      = 0; // 竖轴

            morton.Magicbits(code, ref L, ref B);
            lng = new LngLatSegments(L, true).Degree;
            lat = new LngLatSegments(B, false).Degree;
        }
Exemplo n.º 3
0
        public void DecodeLngLat(UInt64 code, ref double lat, ref double lng)
        {
            var    morton = new Morton2D();
            UInt32 L      = 0; // 横轴
            UInt32 B      = 0; // 竖轴

            morton.Magicbits(code, ref L, ref B);
            lng = new LngLatSegments(L, true).Degree;
            lat = new LngLatSegments(B, false).Degree;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="code">SOT一维编码</param>
        public Tile(string code)
        {
            ulong id    = 0L;
            var   level = 0;

            foreach (var c in code)
            {
                if (char.IsDigit(c))
                {
                    var v     = DecodeChar(c);
                    var shift = ((31 - level) * 2);
                    id = id | ((ulong)v << shift);
                    level++;
                }
            }

            var  morton = new Morton2D();
            uint l      = 0;
            uint b      = 0;

            morton.Magicbits(id, ref l, ref b);
            this.Level  = level;
            this.Corner = new LngLat(b, l);
        }