[OpenLayers-Users] SLD for Openlayers. Need some help.

Arnd Wippermann arnd.wippermann at web.de
Thu Sep 18 12:57:29 EDT 2008


You can add the parameter to your layer declaration
 
var wmsX = new
OpenLayers.Layer.WMS("Gemeinden","http://localhost/cgi-bin/mapserv.exe?",

  { map:"C:/Daten/TestDaten/Map_Dateien/Kanton_ZH_Gemeinden.map",
    layers:"gemeinden",
    format:"image/png",
    EXCEPTIONS:"application/vnd.ogc.se_inimage",
    SLD:"http://localhost/.../gemsee.sld
<BLOCKED::http://localhost/.../gemsee.sld> "
  },{singleTile: true} );

or you can use 
 
wmsX.mergeNewParams({ SLD : 'http://localhost/.../gemsee.sld' });
 
after creating the layer.
 
Generally keep in mind, that the wms server must be able to get the SLD file
via a http request and the server configuration allows retrieving a file
from an unkown client. 
In your case this is no problem, because you use your own localhost server
to get a localhost file.
 
A second way is to use SLD_BODY to send the escaped SLD contents direct with
the wms request.
 
Arnd Wippermann




More information about the Users mailing list