From 45b87bc02db18b96980b3b48aae54728d1b8cde2 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Sat, 21 Jun 2008 13:27:16 +0000 Subject: [PATCH] SRS sent with WFS requests should match projection of requested extents. (Closes #1537) git-svn-id: http://svn.openlayers.org/trunk/openlayers@7415 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/WFS.js | 2 +- tests/Layer/WFS.html | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Layer/WFS.js b/lib/OpenLayers/Layer/WFS.js index 4e079d394c..84254faab1 100644 --- a/lib/OpenLayers/Layer/WFS.js +++ b/lib/OpenLayers/Layer/WFS.js @@ -433,7 +433,7 @@ OpenLayers.Layer.WFS = OpenLayers.Class( * altUrl - {String} Use this as the url instead of the layer's url */ getFullRequestString:function(newParams, altUrl) { - var projectionCode = this.map.getProjection(); + var projectionCode = this.projection.getCode() || this.map.getProjection(); this.params.SRS = (projectionCode == "none") ? null : projectionCode; return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply( diff --git a/tests/Layer/WFS.html b/tests/Layer/WFS.html index 300e9bdb4d..68b2c793a7 100644 --- a/tests/Layer/WFS.html +++ b/tests/Layer/WFS.html @@ -129,6 +129,16 @@ t.eq(layer.tile.url, "http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?typename=OWLS&maxfeatures=10&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG%3A4326&BBOX=-187.890625%2C-36.679687%2C-12.109375%2C156.679688", "Tile URL is set correctly when not encoded"); map.destroy(); } + function test_projection_srs(t) { + t.plan(1); + var map = new OpenLayers.Map('map'); + map.addLayer(new OpenLayers.Layer("",{isBaseLayer: true} )); + var layer = new OpenLayers.Layer.WFS("","",{},{'projection': new OpenLayers.Projection("EPSG:900913")}); + map.addLayer(layer); + map.zoomToMaxExtent(); + var params = OpenLayers.Util.getParameters(layer.getFullRequestString()); + t.eq(params.SRS, "EPSG:900913", "SRS represents projection of WFS layer, instead of map (#1537)"); + }