Hello All,
I am trying to create an opaque square behind my text labels. This works
beautifully when the label is only 1 line but when I have 2 lines, the
square is shifted upward and not fully behind the text. I have tried to
change the anchor point of the graphic and have also tinkered with the
various vendor options but nothing seems to work...
this is what it currently looks like:
<http://osgeo-org.1560.x6.nabble.com/file/n5144484/labelbox_off.jpg>
Here is my code so far, any help would be much appreciated!
<NamedLayer>
<Name>Production</Name>
<UserStyle>
<Title>test</Title>
<Abstract>Basin bubbles based on Sum value</Abstract>
<FeatureTypeStyle>
<Rule>
<Name>Variable</Name>
<Title>Variable</Title>
<ogc:Filter>
<ogc:PropertyIsGreaterThan>
<ogc:PropertyName>val</ogc:PropertyName>
<ogc:Literal>0</ogc:Literal>
</ogc:PropertyIsGreaterThan>
</ogc:Filter>
<MinScaleDenominator>9244667.36</MinScaleDenominator>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#DA291C</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
</Stroke>
</Mark>
<Size>
<ogc:Mul>
<ogc:Literal>100</ogc:Literal>
<ogc:PropertyName>pct</ogc:PropertyName>
</ogc:Mul>
</Size>
</Graphic>
</PointSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>basin</ogc:PropertyName>
<ogc:Function name="numberFormat">
<ogc:Literal>######.##</ogc:Literal>
<ogc:Div>
<ogc:PropertyName>val</ogc:PropertyName>
<ogc:Literal>1000000</ogc:Literal>
</ogc:Div>
</ogc:Function>
<ogc:Function name="Concatenate">
<ogc:Literal>BCF</ogc:Literal>
</ogc:Function>
</Label>
<CssParameter name="font-family">Arial</CssParameter>
<CssParameter name="font-size">12</CssParameter>
<CssParameter name="font-style">normal</CssParameter>
<CssParameter name="font-weight">bold</CssParameter>
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0.5</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>
`<Displacement>
<DisplacementX>0</DisplacementX>
<DisplacementY>
<ogc:Add>
<ogc:Mul>
<ogc:Literal>50</ogc:Literal>
<ogc:PropertyName>pct</ogc:PropertyName>
</ogc:Mul>
<ogc:Literal>12</ogc:Literal>
</ogc:Add>
</DisplacementY>
</Displacement>
</PointPlacement>
</LabelPlacement>
<Graphic>
<Mark>
<WellKnownName>square</WellKnownName>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
<CssParameter name="fill-opacity">0.4</CssParameter>
</Fill>
</Mark>
</Graphic>
<Halo></Halo>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<VendorOption name="graphic-resize">stretch</VendorOption>
<VendorOption name="graphic-margin">5</VendorOption>
<VendorOption name="autoWrap">120</VendorOption>
</TextSymbolizer>
</Rule>
<Rule>
<Name>Inside Circle</Name>
<Title>40% of parent circle</Title>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#771D26</CssParameter>
</Fill>
</Mark>
<Size>
<ogc:Mul>
<ogc:Literal>40</ogc:Literal>
<ogc:PropertyName>pct</ogc:PropertyName>
</ogc:Mul>
</Size>
</Graphic>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
Thanks!
-Kyle B
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Multi-line-Label-with-background-graphic-tp5144484.html
Sent from the GeoServer - User mailing list archive at Nabble.com.