Exemplo n.º 1
0
        /// <summary>
        /// 坐标转经纬度
        /// </summary>
        /// <param name="worldPos"></param>
        /// <returns></returns>
        public static Vector2D Position2LngLat(Vector3 worldPos)
        {
            Vector2D vector2D = new Vector2D(worldPos.x * 256, worldPos.y * 256);


            return(MCTransform.ConvertMC2LL(vector2D));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 将tile(瓦片)坐标系转换为LngLat(地理)坐标系
        /// 18级地图 瓦片图上1个像素等于1个MC单位
        /// </summary>
        /// <param name="tile">瓦片坐标</param>
        /// <param name="pixel">瓦片上的像素坐标</param>
        /// <param name="zoom">缩放比例</param>
        /// <returns></returns>
        public static Vector2D Tile2LngLat(TileData tileData)
        {
            Vector2D vector2D = new Vector2D();

            vector2D.x = tileData.tile.x * 256.0 + tileData.pixel.x;
            vector2D.y = tileData.tile.y * 256.0 + tileData.pixel.y;
            vector2D  /= Math.Pow(2, tileData.zoom - 18);
            return(MCTransform.ConvertMC2LL(vector2D));
        }