diff --git a/lib/OpenLayers/Control/SLDSelect.js b/lib/OpenLayers/Control/SLDSelect.js
index a0d67b7a28..7bb7574bf9 100644
--- a/lib/OpenLayers/Control/SLDSelect.js
+++ b/lib/OpenLayers/Control/SLDSelect.js
@@ -11,6 +11,7 @@
* @requires OpenLayers/Handler/Path.js
* @requires OpenLayers/Handler/Click.js
* @requires OpenLayers/Filter/Spatial.js
+ * @requires OpenLayers/Format/SLD/v1_0_0.js
*/
/**
@@ -272,7 +273,7 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, {
maxScaleDenominator: layer.options.minScale})
]});
}
- return new OpenLayers.Format.SLD().write(sld);
+ return new OpenLayers.Format.SLD({srsName: this.map.getProjection()}).write(sld);
},
/**
diff --git a/tests/Control/SLDSelect.html b/tests/Control/SLDSelect.html
index 41958c23c5..74935539f1 100644
--- a/tests/Control/SLDSelect.html
+++ b/tests/Control/SLDSelect.html
@@ -82,7 +82,7 @@
t.eq(map.layers.length, 2, "Selection layer has been created and added to the map");
t.eq(map.layers[1] instanceof OpenLayers.Layer.WMS, true, "A WMS layer has been created as the selection layer");
t.eq(map.layers[1].tileOptions.maxGetUrlLength, 2048, "Selection layer will automatically switch to HTTP Post if content gets longer than 2048");
- var expected_sld = 'AAA64defaultgeometry-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327#FF00002';
+ var expected_sld = 'AAA64defaultgeometry-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327#FF00002';
t.xml_eq(map.layers[1].params.SLD_BODY, expected_sld, "SLD generated correctly");
@@ -169,7 +169,7 @@
var geometry = OpenLayers.Geometry.Polygon.createRegularPolygon(
new OpenLayers.Geometry.Point(0, 0), 5, 4);
control.select(geometry);
- var expected_sld = 'KGNAT.VKUNSTWERKdefaultgeometry-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327#FF0000KGNAT.LKUNSTWERKdefaultgeometry-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327#FF00002KGNAT.PKUNSTWERKdefaultgeometry-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327square#FF000010';
+ var expected_sld = 'KGNAT.VKUNSTWERKdefaultgeometry-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327#FF0000KGNAT.LKUNSTWERKdefaultgeometry-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327#FF00002KGNAT.PKUNSTWERKdefaultgeometry-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327square#FF000010';
t.xml_eq(map.layers[1].params.SLD_BODY, expected_sld, "SLD generated correctly");
map.destroy();