diff --git a/MapControl/Shared/MapProjection.cs b/MapControl/Shared/MapProjection.cs index aa0a59d6..125e85e4 100644 --- a/MapControl/Shared/MapProjection.cs +++ b/MapControl/Shared/MapProjection.cs @@ -187,7 +187,7 @@ namespace MapControl public void SetViewportTransform(Location projectionCenter, Location mapCenter, Point viewportCenter, double zoomLevel, double rotation) { ProjectionCenter = projectionCenter; - ViewportScale = Math.Pow(2d, zoomLevel) * 256d / (360d * TrueScale); + ViewportScale = 256d * Math.Pow(2d, zoomLevel) / (360d * TrueScale); ViewportRotation = rotation; var center = LocationToPoint(mapCenter); diff --git a/MapControl/Shared/MapTileLayer.cs b/MapControl/Shared/MapTileLayer.cs index 9c7383a7..8432c8c2 100644 --- a/MapControl/Shared/MapTileLayer.cs +++ b/MapControl/Shared/MapTileLayer.cs @@ -22,12 +22,13 @@ namespace MapControl public class MapTileLayer : MapTileLayerBase { public const int TileSize = 256; - public const double MapSize = 2 * Math.PI * MapProjection.Wgs84EquatorialRadius; - public static readonly Point TileGridTopLeft = new Point(-MapSize / 2, MapSize / 2); + + public static readonly Point TileGridTopLeft = new Point( + -180d * MapProjection.Wgs84MetersPerDegree, 180d * MapProjection.Wgs84MetersPerDegree); public static double TileGridScale(int zoomLevel) { - return (TileSize << zoomLevel) / MapSize; + return (TileSize << zoomLevel) / (360d * MapProjection.Wgs84MetersPerDegree); } ///