I am trying to label a layer of line vectors using SLD in Geoserver. It is simple enough, and it's pretty much copied from the SLD cookbook: http://docs.geoserver.org/latest/en/user/styling/sld-cookbook/lines.html
The thing that's getting me is that when I view the Openlayers preview in Geoserver, everything seems to render correctly. Each road is only labeled once and it's not extremely busy looking. However, when I import the layer via WMS to my Openlayers map, it doesn't seem to recognize this line:
<VendorOption name="repeat">400</VendorOption>
Which is supposed to keep it from repeating within 400 pixels.
I've also tried:
<VendorOption name="group">yes</VendorOption>
Which should only display a single label on a map per unique text.
Any idea what is going on here? I need the labels to look like the Geoserver preview.
Map displayed in openlayers after importing layer via WMS:
Map displayed in Geoserver Openlayers preview:
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>Roads</Name>
<UserStyle>
<FeatureTypeStyle>
<Rule>
<Title>Roads</Title>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">
<ogc:Literal>#000000</ogc:Literal>
</CssParameter>
<CssParameter name="stroke-width">
<ogc:Literal>1</ogc:Literal>
</CssParameter>
</Stroke>
</LineSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>name</ogc:PropertyName>
</Label>
<LabelPlacement>
<LinePlacement>
<PerpendicularOffset>
10
</PerpendicularOffset>
</LinePlacement>
</LabelPlacement>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<VendorOption name="repeat">400</VendorOption>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>