Esempio n. 1
0
        public static LLBoundingBox TileXYToRectangleLL(int x, int y, int level)
        {
            var xTiles = GetNumberOfXTilesAtLevel(level);
            var yTiles = GetNumberOfYTilesAtLevel(level);

            var xTileWidth = (world.East - world.West) / xTiles;
            var west       = x * xTileWidth + world.West;
            var east       = (x + 1) * xTileWidth + world.West;

            var yTileHeight = (world.North - world.South) / yTiles;
            var north       = world.North - y * yTileHeight;
            var south       = world.North - (y + 1) * yTileHeight;

            return(new LLBoundingBox(MapUtil.Rad2Deg(west), MapUtil.Rad2Deg(south), MapUtil.Rad2Deg(east), MapUtil.Rad2Deg(north), false));
        }
Esempio n. 2
0
        /// <summary>
        /// Return lat long bounding rect in degrees
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public static LLBoundingBox TileXYZToRectLL(int x, int y, int level)
        {
            y = (int)Math.Pow(2, level) - y - 1; // Very important to flip the Y coord so it goes from bottom to top for our TMS server
            var xTiles = GetNumberOfXTilesAtLevel(level);
            var yTiles = GetNumberOfYTilesAtLevel(level);

            var xTileWidth = (world.East - world.West) / xTiles;
            var west       = x * xTileWidth + world.West;
            var east       = (x + 1) * xTileWidth + world.West;

            var yTileHeight = (world.North - world.South) / yTiles;
            var north       = world.North - y * yTileHeight;
            var south       = world.North - (y + 1) * yTileHeight;

            //return new LLBoundingBox(west, south, east, north);
            return(new LLBoundingBox(MapUtil.Rad2Deg(west), MapUtil.Rad2Deg(south), MapUtil.Rad2Deg(east), MapUtil.Rad2Deg(north), false));
        }