private Extent ToSphericalMercator(Extent orgExent)
        {
            var p1 = ToSphericalMercator(orgExent.XLow, orgExent.YLow);
              var p2 = ToSphericalMercator(orgExent.XHigh, orgExent.YHigh);

              return new Extent
              {
            XLow = p1.X,
            YLow = p1.Y,
            XHigh = p2.X,
            YHigh = p2.Y
              };
        }
        private Extent GetTileExtent(int x, int y, int zoom)
        {
            var tiles = (long)Math.Pow(2, zoom);
              var circumference = TileSize * tiles;
              var radius = circumference / (2 * Math.PI);

              var extent = new Extent
              {
            XLow = XToLong((x - (tiles / 2.0)) * TileSize, radius),
            YLow = YToLat(((tiles / 2.0) - y - 1) * TileSize, radius),
            XHigh = XToLong((x - (tiles / 2.0) + 1) * TileSize, radius),
            YHigh = YToLat(((tiles / 2.0) - y) * TileSize, radius)
              };

              if (Version == "1.3.0" && Epsg == 4326)
              {
            var newTypeExtent = new Extent
            {
              XLow = extent.YLow,
              YLow = extent.XLow,
              XHigh = extent.YHigh,
              YHigh = extent.XHigh
            };
            extent = newTypeExtent;
              }

              if (Epsg == 3857 || Epsg == 900913 )
              {
            extent = ToSphericalMercator(extent);
              }

              return extent;
        }