mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 15:34:49 +02:00
Fix issue with reversed bounding box coordinate order in WMS 1.3 for EPSG:4326 CRS (close #7557)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user