diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index e761059063..cb52b3775d 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -24,6 +24,7 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { namespaces: { sld: "http://www.opengis.net/sld", ogc: "http://www.opengis.net/ogc", + gml: "http://www.opengis.net/gml", xlink: "http://www.w3.org/1999/xlink", xsi: "http://www.w3.org/2001/XMLSchema-instance" }, diff --git a/tests/Format/SLD/v1_0_0.html b/tests/Format/SLD/v1_0_0.html index 9e42ad54ae..fd87a00b90 100644 --- a/tests/Format/SLD/v1_0_0.html +++ b/tests/Format/SLD/v1_0_0.html @@ -261,6 +261,40 @@ t.xml_eq(node, expected, "TextSymbolizer correctly written"); + } + + function test_writeSpatialFilter(t) { + + t.plan(1); + + var format = new OpenLayers.Format.SLD.v1_0_0(); + + var rule = new OpenLayers.Rule({ + name: "test", + filter: new OpenLayers.Filter.Spatial({ + type: OpenLayers.Filter.Spatial.BBOX, + value: new OpenLayers.Bounds(0, 0, 10, 10) + }) + }); + + var sld = format.writeNode("sld:Rule", rule); + + var expect = + '' + + 'test' + + '' + + '' + + '' + + '' + + '0,0 10,10' + + '' + + '' + + '' + + ''; + + t.xml_eq(sld, expect, "rule with spatial filter correctly written"); + + }