[OpenLayers-Users] Vector Layer Labels

Andrew Haigh haighaj+ollist at googlemail.com
Thu Mar 18 04:47:26 EDT 2010


OpenLayers Nightly Build Revision 10086
GeoServer 2.0.1

I'm attempting to label a vector layer using a Style Layer Descriptor (see
below) which works fine in GeoServer but the labels do not display in
OpenLayers. I can do the same thing using the OpenLayers.Style object but
I'd really like use the same SLD as used by GeoServer.

I've found a discussion thread from 2008 which says that the SLD
TextSymbolizer is only supported for reading / writing but can't be used for
display purposes. As such can anybody advise if the SLD TextSymbolizer can
be used for displaying labels with the current trunk; if it will be included
in 2.9; or if it supported is there an error in my SLD?

Many thanks in advance

Andrew


--- Start SLD (xml ns tags removed) ---
<sld:StyledLayerDescriptor version="1.0.0">
  <sld:NamedLayer>
    <sld:Name>ParcelView</sld:Name>
    <sld:UserStyle>
      <sld:IsDefault>1</sld:IsDefault>
      <sld:FeatureTypeStyle>
        <sld:Rule>
            <sld:MaxScaleDenominator>300000</sld:MaxScaleDenominator>
            <sld:PolygonSymbolizer>
                <!-- the fill displays correctly -->
                <sld:Fill>
                    <sld:CssParameter name="fill">
                    <ogc:Literal>#FFFAE6</ogc:Literal>
                    </sld:CssParameter>
                    <sld:CssParameter name="fill-opacity">
                    <ogc:Literal>0.75</ogc:Literal>
                    </sld:CssParameter>
                </sld:Fill>
                <!-- the label does not show -->
                <sld:Stroke>
                    <sld:CssParameter name="stroke">
                    <ogc:Literal>#B2B2B2</ogc:Literal>
                    </sld:CssParameter>
                    <sld:CssParameter name="stroke-width">
                    <ogc:Literal>0.4</ogc:Literal>
                    </sld:CssParameter>
                </sld:Stroke>
            </sld:PolygonSymbolizer>
            <sld:TextSymbolizer>
              <sld:Label>
                <ogc:PropertyName>FULL_PARCEL_ID</ogc:PropertyName>
              </sld:Label>
              <sld:Font>
                <sld:CssParameter name="font-family">
                  <ogc:Literal>Times New Roman</ogc:Literal>
                </sld:CssParameter>
              </sld:Font>
              <sld:Fill>
                <sld:CssParameter name="fill">
                    <ogc:Literal>#000000</ogc:Literal>
                </sld:CssParameter>
              </sld:Fill>
            </sld:TextSymbolizer>
        </sld:Rule>
      </sld:FeatureTypeStyle>
    </sld:UserStyle>
  </sld:NamedLayer>
</sld:StyledLayerDescriptor>
--- End SLD ---
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100318/723b7391/attachment.html


More information about the Users mailing list