Use the layer's projection.
In setMap, the layer gets the map's projection if it doesn't have its own. And since a layer can have a different SRS code than the map (but a compatible one, i.e. with OpenLayers.Projection.transforms[mapProj][layerProj] being OpenLayer.Projection.nullTransform), the axis order can be different.
This commit is contained in:
@@ -175,7 +175,7 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* {Boolean} true if the axis order is reversed, false otherwise.
|
* {Boolean} true if the axis order is reversed, false otherwise.
|
||||||
*/
|
*/
|
||||||
reverseAxisOrder: function() {
|
reverseAxisOrder: function() {
|
||||||
var projCode = this.map.getProjectionObject().getCode();
|
var projCode = this.projection.getCode();
|
||||||
return parseFloat(this.params.VERSION) >= 1.3 &&
|
return parseFloat(this.params.VERSION) >= 1.3 &&
|
||||||
!!(this.yx[projCode] || OpenLayers.Projection.defaults[projCode].yx);
|
!!(this.yx[projCode] || OpenLayers.Projection.defaults[projCode].yx);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -290,19 +290,19 @@
|
|||||||
function test_mixedParams(t) {
|
function test_mixedParams(t) {
|
||||||
t.plan(5);
|
t.plan(5);
|
||||||
var map = new OpenLayers.Map("map", {
|
var map = new OpenLayers.Map("map", {
|
||||||
getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));},
|
getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));}
|
||||||
getProjectionObject: function() {return new OpenLayers.Projection("EPSG:4326");}
|
|
||||||
});
|
});
|
||||||
|
var geographic = new OpenLayers.Projection("EPSG:4326");
|
||||||
|
|
||||||
var a = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", {
|
var a = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", {
|
||||||
layers: "a,b,c,d",
|
layers: "a,b,c,d",
|
||||||
styles: "a,b,c,d"
|
styles: "a,b,c,d"
|
||||||
}, {map: map});
|
}, {projection: geographic});
|
||||||
|
|
||||||
var b = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", {
|
var b = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", {
|
||||||
layers: ["a","b","c","d"],
|
layers: ["a","b","c","d"],
|
||||||
styles: ["a","b","c","d"]
|
styles: ["a","b","c","d"]
|
||||||
}, {map: map});
|
}, {projection: geographic});
|
||||||
|
|
||||||
var c = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", {
|
var c = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", {
|
||||||
layers: ["a","b","c","d"]
|
layers: ["a","b","c","d"]
|
||||||
@@ -310,13 +310,13 @@
|
|||||||
|
|
||||||
var d = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", {
|
var d = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", {
|
||||||
layers: "a,b,c,d"
|
layers: "a,b,c,d"
|
||||||
}, {map: map});
|
}, {projection: geographic});
|
||||||
|
|
||||||
var click = new OpenLayers.Control.WMSGetFeatureInfo({
|
var click = new OpenLayers.Control.WMSGetFeatureInfo({
|
||||||
featureType: 'type',
|
featureType: 'type',
|
||||||
featureNS: 'ns',
|
featureNS: 'ns',
|
||||||
layers: [a, b, c, d]
|
layers: [a, b, c, d]
|
||||||
}, {map: map});
|
}, {projection: geographic});
|
||||||
|
|
||||||
map.addControl(click);
|
map.addControl(click);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user