diff --git a/MapControl/Shared/MapImageLayer.cs b/MapControl/Shared/MapImageLayer.cs index c67d6a85..641d8540 100644 --- a/MapControl/Shared/MapImageLayer.cs +++ b/MapControl/Shared/MapImageLayer.cs @@ -23,7 +23,7 @@ using System.Windows.Threading; namespace MapControl { /// - /// Map image layer. Fills the entire viewport with a map image, e.g. provided by a Web Map Service (WMS). + /// Map image layer. Fills the entire viewport with a map image, e.g. provided by a Web Map Service. /// The image must be provided by the abstract GetImageAsync method. /// public abstract class MapImageLayer : MapPanel, IMapLayer diff --git a/MapControl/Shared/WmsImageLayer.cs b/MapControl/Shared/WmsImageLayer.cs index 82bfa5e4..f0363301 100644 --- a/MapControl/Shared/WmsImageLayer.cs +++ b/MapControl/Shared/WmsImageLayer.cs @@ -150,9 +150,10 @@ namespace MapControl uri += "&FORMAT=" + Format; } + var crs = GetCrsValue(); var rect = projection.BoundingBoxToRect(BoundingBox); - uri += "&" + GetBboxParameters(rect); + uri += "&" + GetBboxParameters(crs, rect); uri += "&WIDTH=" + (int)Math.Round(projection.ViewportScale * rect.Width); uri += "&HEIGHT=" + (int)Math.Round(projection.ViewportScale * rect.Height); @@ -162,18 +163,6 @@ namespace MapControl return imageUri; } - /// - /// Gets a query substring for the projected bounding box, which contains the CRS and BBOX or equivalent parameters. - /// - protected virtual string GetBboxParameters(Rect bbox) - { - var crsId = GetCrsValue(); - - return string.Format(CultureInfo.InvariantCulture, - crsId == "EPSG:4326" ? "CRS={0}&BBOX={2},{1},{4},{3}" : "CRS={0}&BBOX={1},{2},{3},{4}", - crsId, bbox.X, bbox.Y, (bbox.X + bbox.Width), (bbox.Y + bbox.Height)); - } - /// /// Gets the effective value of the CRS query parameter. /// @@ -197,6 +186,16 @@ namespace MapControl return crsId; } + /// + /// Gets a query substring for the projected bounding box, which contains the CRS and BBOX or equivalent parameters. + /// + protected virtual string GetBboxParameters(string crs, Rect bbox) + { + return string.Format(CultureInfo.InvariantCulture, + crs == "EPSG:4326" ? "CRS={0}&BBOX={2},{1},{4},{3}" : "CRS={0}&BBOX={1},{2},{3},{4}", + crs, bbox.X, bbox.Y, (bbox.X + bbox.Width), (bbox.Y + bbox.Height)); + } + private string GetRequestUri(string request) { var uri = ServiceUri.ToString();