I have a problem my label names on my features are getting rendered several
times,
http://ema.henrycountytn.org/gis.htm?zoom=3&lat=36.2981&lon=-88.31292&layers=B
Here is my SLD File, I only want the name of the polygon shown once not
several times.
Any help would be appreciated! I am using PostGis if this might make a
difference
<?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>ncounties</Name>
<UserStyle>
<Name>ncounties_style</Name>
<Title>geoserver style</Title>
<Abstract>Generated by GeoServer</Abstract>
<FeatureTypeStyle>
<Rule>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#FFA54F</CssParameter>
<CssParameter name="fill-opacity">0</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#FFFFFF</CssParameter>
<CssParameter name="stroke-opacity">1</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
</Stroke>
</PolygonSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>name</ogc:PropertyName>
</Label>
<CssParameter name="font-family">Times New Roman</CssParameter>
<CssParameter name="font-style">Normal</CssParameter>
<CssParameter name="font-size">14</CssParameter>
<CssParameter name="font-weight">bold</CssParameter>
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0.5</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>
</PointPlacement>
</LabelPlacement>
<Halo>
<Radius>
<ogc:Literal>1</ogc:Literal>
</Radius>
<Fill>
<CssParameter name="fill">#ffffff</CssParameter>
<CssParameter name="fill-opacity">0.85</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<VendorOption name="group">false</VendorOption>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
--
View this message in context: http://www.nabble.com/Multipal-Lables-on-Feature!-tp21114699p21114699.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
Hi,
you are using tiles. If you look carefully you'll notice that the labels repeat exactly once for every tile. This is because WMS does not maintain state between requests, GeoServer has no idea what labels were drawn in tiles you have requested previously, it only picks the most appropriate ones for the current tile. Metatiling is the best way to improve this, see http://geowebcache.org/trac/wiki/metatiles
You have two options:
1) Append tiled=true to every request. There's an option for it in OpenLayers. This will give you 3x3 metatiling and probably be enough since the map you show is very small.
2) Use GeoWebCache, which has 4x4 metatiling by default. Create a layer group (Configuration ->WMS -> Content) that contains the layers in the request above, then restart GeoServer.
Here's an example with just the counties: http://ema.henrycountytn.org/geoserver/gwc/demo/topp:uscounty?srs=EPSG:4326
You'll find the layer group here after the restart: http://ema.henrycountytn.org/geoserver/gwc/demo
Option 2 will require you to change your OpenLayers client slighty, to align to the grid. It's probably easier to use the automatically generated demo as a starting point, so you get bounds and resolutions right.
-Arne
brizey02 wrote:
I have a problem my label names on my features are getting rendered several
times,
http://ema.henrycountytn.org/gis.htm?zoom=3&lat=36.2981&lon=-88.31292&layers=B
Here is my SLD File, I only want the name of the polygon shown once not
several times.
Any help would be appreciated! I am using PostGis if this might make a
difference
<?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>ncounties</Name>
<UserStyle>
<Name>ncounties_style</Name>
<Title>geoserver style</Title>
<Abstract>Generated by GeoServer</Abstract>
<FeatureTypeStyle>
<Rule>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#FFA54F</CssParameter>
<CssParameter name="fill-opacity">0</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#FFFFFF</CssParameter>
<CssParameter name="stroke-opacity">1</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
</Stroke>
</PolygonSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>name</ogc:PropertyName>
</Label>
<CssParameter name="font-family">Times New Roman</CssParameter>
<CssParameter name="font-style">Normal</CssParameter>
<CssParameter name="font-size">14</CssParameter>
<CssParameter name="font-weight">bold</CssParameter>
<LabelPlacement>
<PointPlacement> <AnchorPoint>
<AnchorPointX>0.5</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>
</PointPlacement> </LabelPlacement>
<Halo>
<Radius>
<ogc:Literal>1</ogc:Literal>
</Radius>
<Fill>
<CssParameter name="fill">#ffffff</CssParameter>
<CssParameter name="fill-opacity">0.85</CssParameter> </Fill>
</Halo>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<VendorOption name="group">false</VendorOption>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
--
Arne Kepp
OpenGeo - http://opengeo.org
Expert service straight from the developers