I would like to split the style of my labels, which consist of 2 attributes.
I already managed to separate the lines, but I need to style them differently as well, as the second line should be bold.
Currently my map looks like this:
And I would like it to look like this:
I would prefer to do it in CSS, but I also prepared the style in SLD, so I would be happy for a solution in either of them.
My code looks like this in CSS:
* {
label: [IDENT][LOWERLIMIT];
-gt-label-auto-wrap: 1;
font-weight: normal;
font-fill: black;
}
and like this in SLD:
<Rule>
<TextSymbolizer>
<Label>
<ogc:PropertyName>IDENT</ogc:PropertyName><![CDATA[
]]>
<ogc:PropertyName>LOWERLIMIT</ogc:PropertyName>
</Label>
<Font>
<CssParameter name="font-fill">black</CssParameter>
<CssParameter name="font-weight">normal</CssParameter>
</Font>
</TextSymbolizer>
</Rule>
Best Answer
Here is a solution in SLD but I think you should be able to generate the same in CSS.
The trick is to use 2 TextSymbolizers and offset them so that they don't overlap.
Depending on your font and polygon sizes you can play with the
AnchorPoint
s andDisplacement
s to adjust the exact placement of the labels.