[OpenLayers-Users] SLD file and labels

Tim Schaub tschaub at opengeo.org
Thu Jul 10 17:32:00 EDT 2008


Hey-

hcan-hcan wrote:
> Hi!
> 
> I'm using the label examples from camptocamp's sandbox (vectors-with-text).
> Works just fine! Now I have started to  create some themes using and  SLD
> xml file, the same way as in the Styled Layer Descriptor (SLD) Example. Is
> there a way to get the labels working using an SLD file? What I had in mind
> was something like this:
> 
> <sld:CssParameter name="label">
> 	<ogc:Literal>name: ${name}</ogc:Literal>
> </sld:CssParameter>
> <sld:CssParameter name="fontColor">
> 	<ogc:Literal>red</ogc:Literal>
> </sld:CssParameter>
> <sld:CssParameter name="fontWeight">
> 	<ogc:Literal>bold</ogc:Literal>
> </sld:CssParameter>
> 

The SLD spec includes an sld:TextSymbolizer element.  This element has 
optional children sld:Font, sld:Label, and sld:Fill - all of which are 
supported (in the writers) as of http://trac.openlayers.org/changeset/7333.

If the SLD parser is given a symbolizer keyed by 'Text', it will write 
an sld:TextSymbolizer element.

In OpenLayers a text symbolizer should have the following properties:
label, fontFamily, fontSize, fillColor, fillOpacity
(We can add in support for fontStyle and fontWeight.)

It would be great to get the vectors labeling stuff in the trunk - and 
we should make sure we're following the same conventions for describing 
a text symbolizer.

Tim

> However, I could not get it working. Does anyone know if this is possible?
> Or has another solution...
> 
> Thanks,
> 
> //H




More information about the Users mailing list