I'm having troubles getting my TextSymbolizer label to center properly. According to what I've read, the label is to be centered upon the given polygon based on the viewable area. The majority of my polygon is not being displayed, although for my given viewport/zoom, this polygon is taking up 95% of my view. Based on this, I would expect to see the label towards the center of my screen. It is however pushed really close to the top of the view. In my sld I have the LabelPlacement being defined as: <PointPlacement auto="true"/>. Am I missing something fundamental here? The problem is that as the label is displayed so close to the top, once I zoom in 1 more level, the label leaves my view completely.
If anyone can point me in the right direction, I'd appreciate it.
--
__________________________________
Jeremy Nix
Senior Application Developer
Southwest Financial Services, Ltd.
(513) 621-6699
I'm still having problems trying to center my label upon my polygon. From zooming in/out it seems as though the label always centers upon the centroid of the entire polygon, and not the centroid of the viewable (rendered) portion of the polygon. Is this by design? Have I configured something incorrectly?
I appreciate any help you can give.
Here's my environment:
Java: 1.6.0_06-b02
JAI: 1.1.3
ImageIO: 1.1
Tomcat: 6.0.16
Geoserver: 1.6.4b
My SLD looks like this:
<?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>US Counties</Name>
<UserStyle>
<Title>US Counties Style</Title>
<FeatureTypeStyle>
<FeatureTypeName>Feature</FeatureTypeName>
<Rule>
<MinScaleDenominator>0</MinScaleDenominator>
<MaxScaleDenominator>500000</MaxScaleDenominator>
<PolygonSymbolizer>
<Stroke>
<CssParameter name="stroke">#4E4E4E</CssParameter>
<CssParameter name="stroke-width">1.5</CssParameter>
<CssParameter name="stroke-dasharray">6</CssParameter>
<CssParameter name="stroke-dashoffset">6</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
<Rule>
<MinScaleDenominator>0</MinScaleDenominator>
<MaxScaleDenominator>1000000</MaxScaleDenominator>
<PolygonSymbolizer>
<Stroke>
<CssParameter name="stroke">#4E4E4E</CssParameter>
<CssParameter name="stroke-width">1.5</CssParameter>
<CssParameter name="stroke-dasharray">6</CssParameter>
<CssParameter name="stroke-dashoffset">6</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
<Rule>
<MinScaleDenominator>10000</MinScaleDenominator>
<MaxScaleDenominator>1000000</MaxScaleDenominator>
<TextSymbolizer>
<Geometry>
<ogc:PropertyName>poly</ogc:PropertyName>
</Geometry>
<Label>
<ogc:PropertyName>countyname</ogc:PropertyName>
</Label>
<Font>
<CssParameter name="font-family">/opt/tomcat/fonts/arial.ttf</CssParameter>
<CssParameter name="font-style">Normal</CssParameter>
<CssParameter name="font-size">18</CssParameter>
<CssParameter name="font-weight">bold</CssParameter>
</Font>
<LabelPlacement>
<PointPlacement auto="true"/>
</LabelPlacement>
<Halo>
<Radius>
<ogc:Literal>4</ogc:Literal>
</Radius>
<Fill>
<CssParameter name="fill">#4E4E4E</CssParameter>
<CssParameter name="fill-opacity">1</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
<CssParameter name="fill-opacity">1</CssParameter>
</Fill>
<VendorOption name="group">yes</VendorOption>
<VendorOption name="spaceAround">5</VendorOption>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
__________________________________
Jeremy Nix
Senior Application Developer
Southwest Financial Services, Ltd.
(513) 621-6699
Jeremy Nix wrote:
I'm having troubles getting my TextSymbolizer label to center properly. According to what I've read, the label is to be centered upon the given polygon based on the viewable area. The majority of my polygon is not being displayed, although for my given viewport/zoom, this polygon is taking up 95% of my view. Based on this, I would expect to see the label towards the center of my screen. It is however pushed really close to the top of the view. In my sld I have the LabelPlacement being defined as: <PointPlacement auto="true"/>. Am I missing something fundamental here? The problem is that as the label is displayed so close to the top, once I zoom in 1 more level, the label leaves my view completely.
If anyone can point me in the right direction, I'd appreciate it.
Jeremy Nix ha scritto:
I'm still having problems trying to center my label upon my polygon. From zooming in/out it seems as though the label always centers upon the centroid of the entire polygon, and not the centroid of the viewable (rendered) portion of the polygon. Is this by design? Have I configured something incorrectly?
Hi Jeremy,
sorry for the late response. It turns out you've spotted a bug, I opened
a jira issue about it:
http://jira.codehaus.org/browse/GEOS-2042
Cheers
Andrea