[OpenLayers-Dev] text rendering support in openlayers for wfs
layers
Andreas Hocevar
andreas.hocevar at gmail.com
Mon Nov 5 16:11:27 EST 2007
Hi,
it would be great to have text labels on vector features!
On 11/5/07, dave c <dc at openapp.ie> wrote:
> One reason to get text rendering working for example was, i needed to be able
> to output the names of certain hospitals on a map centered on there point on
> the map. Firstly i have "extractAttributes: true" and added an layer option
> called "textAttrToDisplay" which is the name of the attribute to be
> displayed within each feature that was coming from my database.
This is one way to do it, but defining text labels as style property
instead of a layer property would be a better way, if labelling should
later be defined by StyledLayerDescriptor (SLD). So instead of using
layer.textAttrToDisplay
you should use
layer.style.textSymbolizerProperty
The name "textSymbolizerProperty" instead of "textAttrToDisplay" would
be more conform to the SLD specification.
As a next step, the font and placement of the label could also be
defined using style properties. Again, a look at the TextSymbolizer in
the SLD specification [1] will give you an idea.
Regards,
Andreas.
[1] http://portal.opengeospatial.org/files/?artifact_id=1188
More information about the Dev
mailing list