Hello David,
I've noticed that in some of the labeling SLD (example, city-1.sld,
line 35 - 57), the PointPlacement options 'Displacement' and
'AnchorPoint' are being used and it moves the text label correctly,
however it also moves the city symbol graphic to be in the center of
the text .... essentially moving the actual city symbol to an
incorrect location.
I think it is because in the Rule, the point placement of the
TextSymbolizer is also used for the actual graphic of the city symbol.
However, I know that the labeling also relies on the
VendorOption:SpaceAround. I'm not sure how to keep the city symbol in
the correct location as well as move the label placement not directly
over the city (x=0.5, y=0.5) & use the SpaceAround option so their
aren't overlapping labels & city symbols. The specific Rule am
referring to is in city-1.sld, line 10 - 149 (copied into discussion
below).
Is there a solution or should I just alter all the displacement to be
0 & the anchors to be 0.5?
Thanks,
Hailey
<sld:Rule>
<ogc:Filter>
<ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>place</ogc:PropertyName>
<ogc:Literal>city</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>place</ogc:PropertyName>
<ogc:Literal>metropolis</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
<sld:MinScaleDenominator>3000000.0</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>1.25E7</sld:MaxScaleDenominator>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>name</ogc:PropertyName>
</sld:Label>
<sld:Font>
<sld:CssParameter name="font-family">unifont Medium</
sld:CssParameter>
<sld:CssParameter name="font-size">11</sld:CssParameter>
<sld:CssParameter name="font-style">normal</
sld:CssParameter>
<sld:CssParameter name="font-weight">bold</
sld:CssParameter>
</sld:Font>
<sld:LabelPlacement>
<sld:PointPlacement>
<sld:AnchorPoint>
<sld:AnchorPointX>
<ogc:Literal>0.5</ogc:Literal>
</sld:AnchorPointX>
<sld:AnchorPointY>
<ogc:Literal>0.5</ogc:Literal>
</sld:AnchorPointY>
</sld:AnchorPoint>
<sld:Displacement>
<sld:DisplacementX>
<ogc:Literal>0</ogc:Literal>
</sld:DisplacementX>
<sld:DisplacementY>
<ogc:Literal>-12</ogc:Literal>
</sld:DisplacementY>
</sld:Displacement>
<sld:Rotation>
<ogc:Literal>0</ogc:Literal>
</sld:Rotation>
</sld:PointPlacement>
</sld:LabelPlacement>
<sld:Halo>
<sld:Radius>
<ogc:Literal>2</ogc:Literal>
</sld:Radius>
<sld:Fill>
<sld:CssParameter name="fill">#ffffff</
sld:CssParameter>
<sld:CssParameter name="fill-opacity">0.25</
sld:CssParameter>
</sld:Fill>
</sld:Halo>
<sld:Fill>
<sld:CssParameter name="fill">#2b2b2b</sld:CssParameter>
</sld:Fill>
<sld:Graphic>
<sld:ExternalGraphic>
<sld:OnlineResource xmlns:xlink="
http://www.w3.org/
1999/xlink" xlink:type="simple" xlink:href="file:/var/lib/tomcat6/
webapps/geoserver/geoserver_data/styles/small-city.svg"/>
<sld:Format>image/svg+xml</sld:Format>
</sld:ExternalGraphic>
</sld:Graphic>
<sld:VendorOption name="autoWrap">0</sld:VendorOption>
<sld:VendorOption name="spaceAround">5</sld:VendorOption>
</sld:TextSymbolizer>
</sld:Rule>
<sld:Rule>
<ogc:Filter>
<ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>place</ogc:PropertyName>
<ogc:Literal>city</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>place</ogc:PropertyName>
<ogc:Literal>metropolis</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
<sld:MinScaleDenominator>750000.0</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>3000000.0</sld:MaxScaleDenominator>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>name</ogc:PropertyName>
</sld:Label>
<sld:Font>
<sld:CssParameter name="font-family">unifont Medium</
sld:CssParameter>
<sld:CssParameter name="font-size">13</sld:CssParameter>
<sld:CssParameter name="font-style">normal</
sld:CssParameter>
<sld:CssParameter name="font-weight">bold</
sld:CssParameter>
</sld:Font>
<sld:LabelPlacement>
<sld:PointPlacement>
<sld:AnchorPoint>
<sld:AnchorPointX>
<ogc:Literal>0.5</ogc:Literal>
</sld:AnchorPointX>
<sld:AnchorPointY>
<ogc:Literal>0.5</ogc:Literal>
</sld:AnchorPointY>
</sld:AnchorPoint>
<sld:Displacement>
<sld:DisplacementX>
<ogc:Literal>0</ogc:Literal>
</sld:DisplacementX>
<sld:DisplacementY>
<ogc:Literal>-13</ogc:Literal>
</sld:DisplacementY>
</sld:Displacement>
<sld:Rotation>
<ogc:Literal>0</ogc:Literal>
</sld:Rotation>
</sld:PointPlacement>
</sld:LabelPlacement>
<sld:Halo>
<sld:Radius>
<ogc:Literal>2</ogc:Literal>
</sld:Radius>
<sld:Fill>
<sld:CssParameter name="fill">#ffffff</
sld:CssParameter>
<sld:CssParameter name="fill-opacity">0.25</
sld:CssParameter>
</sld:Fill>
</sld:Halo>
<sld:Fill>
<sld:CssParameter name="fill">#2b2b2b</sld:CssParameter>
</sld:Fill>
<sld:Graphic>
<sld:ExternalGraphic>
<sld:OnlineResource xmlns:xlink="
http://www.w3.org/
1999/xlink" xlink:type="simple" xlink:href="file:/var/lib/tomcat6/
webapps/geoserver/geoserver_data/styles/large-city.svg"/>
<sld:Format>image/svg+xml</sld:Format>
</sld:ExternalGraphic>
</sld:Graphic>
<sld:VendorOption name="autoWrap">0</sld:VendorOption>
<sld:VendorOption name="spaceAround">5</sld:VendorOption>
</sld:TextSymbolizer>
</sld:Rule>