Minor tile layer updates

This commit is contained in:
ClemensF 2020-10-25 16:09:09 +01:00
parent ea992d3d0f
commit ddf77441f2
10 changed files with 124 additions and 86 deletions

View file

@ -3,7 +3,6 @@
// Licensed under the Microsoft Public License (Ms-PL)
using System;
using System.Globalization;
using System.Threading.Tasks;
#if WINDOWS_UWP
using Windows.UI.Xaml.Media;
@ -89,29 +88,4 @@ namespace MapControl
return base.GetUri(x, (1 << zoomLevel) - 1 - y, zoomLevel);
}
}
public class BoundingBoxTileSource : TileSource
{
public override Uri GetUri(int x, int y, int zoomLevel)
{
Uri uri = null;
if (UriFormat != null)
{
var tileSize = 360d / (1 << zoomLevel); // tile width in degrees
var west = MapProjection.Wgs84MetersPerDegree * (x * tileSize - 180d);
var east = MapProjection.Wgs84MetersPerDegree * ((x + 1) * tileSize - 180d);
var south = MapProjection.Wgs84MetersPerDegree * (180d - (y + 1) * tileSize);
var north = MapProjection.Wgs84MetersPerDegree * (180d - y * tileSize);
uri = new Uri(UriFormat
.Replace("{west}", west.ToString(CultureInfo.InvariantCulture))
.Replace("{south}", south.ToString(CultureInfo.InvariantCulture))
.Replace("{east}", east.ToString(CultureInfo.InvariantCulture))
.Replace("{north}", north.ToString(CultureInfo.InvariantCulture)));
}
return uri;
}
}
}