Fix issue with reversed bounding box coordinate order in WMS 1.3 for EPSG:4326 CRS (close #7557)

This commit is contained in:
Quincy Morgan
2020-07-24 17:43:52 -04:00
parent b9a82a98e1
commit bd9d4bce74
+17 -10
View File
@@ -112,7 +112,7 @@ export function rendererBackgroundSource(data) {
// Guess a type based on the tokens present in the template
// (This is for 'custom' source, where we don't know)
if (!source.type) {
if (/\{(proj|wkid|bbox)\}/.test(_template)) {
if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(_template)) {
source.type = 'wms';
source.projection = 'EPSG:3857'; // guess
} else if (/\{(x|y)\}/.test(_template)) {
@@ -159,23 +159,30 @@ export function rendererBackgroundSource(data) {
switch (key) {
case 'width':
case 'height':
return tileSize;
return tileSize;
case 'proj':
return projection;
return projection;
case 'wkid':
return projection.replace(/^EPSG:/, '');
return projection.replace(/^EPSG:/, '');
case 'bbox':
return minXmaxY.x + ',' + maxXminY.y + ',' + maxXminY.x + ',' + minXmaxY.y;
// WMS 1.3 flips x/y for some coordinate systems including EPSG:4326 - #7557
if (projection === 'EPSG:4326' &&
// The CRS parameter implies version 1.3 (prior versions use SRS)
/VERSION=1.3|CRS={proj}/.test(source.template())) {
return maxXminY.y + ',' + minXmaxY.x + ',' + minXmaxY.y + ',' + maxXminY.x;
} else {
return minXmaxY.x + ',' + maxXminY.y + ',' + maxXminY.x + ',' + minXmaxY.y;
}
case 'w':
return minXmaxY.x;
return minXmaxY.x;
case 's':
return maxXminY.y;
return maxXminY.y;
case 'n':
return maxXminY.x;
return maxXminY.x;
case 'e':
return minXmaxY.y;
return minXmaxY.y;
default:
return token;
return token;
}
});