[OpenLayers-Users] SLD with WFS ??

Tim Schaub noreply at geocartic.com
Mon Jul 9 13:57:37 EDT 2007


Hello-

Husson Florian wrote:
>  Can I bind a SLD with a WFS layer, more or less like that : 
>  
> Layer = new OpenLayers.Layer.WFS( name, "/geoserver/wfs", 
> 
> { typename: name,    extractAttributes: true,   SLD :
> "http://localhost:8080/geoserver/data/styles/Lakes.sld"} );
> 
>  For the moment, that doesn't work... Is this possible ? 

Note that the WFS layer takes 4 arguments[1].  You are including the 
"SLD" and "extractAttributes" properties in the third argument above. 
These get mapped to parameter names in the GetFeature request.

The "extractAttributes" property belongs in the options argument (the 
fourth).  This tells OpenLayers to extract all attributes of the 
returned features.  It doesn't mean anything as a parameter in the 
GetFeature request.

Putting the "SLD" parameter in the third argument makes it one of the 
named parameters in your GetFeature query string.  For WMS, you can do 
this - make a GetMap request with a URL to an SLD doc.  The WFS spec 
does not say what to do with an SLD parameter in the GetFeature request. 
  This means that the way you've set things up above, you shouldn't 
expect anything to happen.

If you did mean to include the SLD property in the options argument, as 
Chis mentions, this also currently means nothing to OpenLayers.  This 
could change in the future.

Hope that makes sense,
Tim

[1] 
http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/WFS-js.html#OpenLayers.Layer.WFS.OpenLayers.Layer.WFS



More information about the Users mailing list