for several hours Im trying to create a multiline label for a line. I use Geoserver 2.5, the line is in postGIS, the style is very simple :
<?xml version="1.0" encoding="UTF-8"?> <sld:StyledLayerDescriptor
xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" version="1.0.0"> <sld:NamedLayer>
<sld:Name>Borders_1fe760e8</sld:Name>
<sld:UserStyle>
<sld:Name>Borders_1fe760e8</sld:Name>
<sld:Title>Borders</sld:Title>
<sld:IsDefault>1</sld:IsDefault>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<sld:Name>rule1</sld:Name>
<sld:Title>Title 1</sld:Title>
<sld:Abstract>-</sld:Abstract>
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter name="stroke">#FF0000</sld:CssParameter>
<sld:CssParameter name="stroke-width">2</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
<sld:TextSymbolizer>
<Label>
<ogc:PropertyName>Name_1</ogc:PropertyName><![CDATA[
]]><ogc:PropertyName>Name_2</ogc:PropertyName>
</Label>
<sld:Font>
<sld:CssParameter name="font-family">Tahoma</sld:CssParameter>
<sld:CssParameter name="font-size">16</sld:CssParameter>
<sld:CssParameter name="font-style">normal</sld:CssParameter>
<sld:CssParameter name="font-weight">normal</sld:CssParameter>
</sld:Font>
<sld:LabelPlacement>
<sld:PointPlacement>
<sld:AnchorPoint>
<sld:AnchorPointX>0.0</sld:AnchorPointX>
<sld:AnchorPointY>0.5</sld:AnchorPointY>
</sld:AnchorPoint>
</sld:PointPlacement>
</sld:LabelPlacement>
<sld:Fill>
<sld:CssParameter name="fill">#FF0000</sld:CssParameter>
</sld:Fill>
<sld:VendorOption name="followLine">true</sld:VendorOption>
</sld:TextSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle> </sld:NamedLayer> </sld:StyledLayerDescriptor>
yet I am unable to see the lables 1 and 2 on two lines - they always end up on the same line. I tried :
- SLD - CDATA with line break (as seen above)
- SLD - CDATA with
<BR>
tag - SLD - use only one field, POSTGIS field value with \n (value1\nvalue2)
- SLD - use only one field, POSTGIS field value with
<br>
tag (value1<br>
value2)
and many other permutations of above, i copy-pasted the code, typed it, used geoserver style editor, typed it manually into xml file directly on the server, but I wasnt able to produce two line label. I did try all the tricks I was able to find via google.
What am I doing wrong ? Or is it some known Geoserver bug ?