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:Title>Title 1</sld:Title>
                  <sld:CssParameter name="stroke">#FF0000</sld:CssParameter>
                  <sld:CssParameter name="stroke-width">2</sld:CssParameter>
                  <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:CssParameter name="fill">#FF0000</sld:CssParameter>
                <sld:VendorOption name="followLine">true</sld:VendorOption>
        </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 ?

  • I have an SLD that works fine for me on geoserver 2.5 May 5, 2014 at 10:36
  • Can you please share ? or is it same as I already tried ?
    – Radek
    May 5, 2014 at 10:39

3 Answers 3


Here some snippets of my SLD on geoserver 2.5:

<?xml version="1.0" encoding="ISO-8859-1"?>


<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"


      <Name>Rule 1</Name>
       ]]> (<ogc:PropertyName>nome_2</ogc:PropertyName>)
          <CssParameter name="font-family">Arial</CssParameter>
          <CssParameter name="font-weight">bold</CssParameter>
          <CssParameter name="font-size">10</CssParameter>

--vendor options

        <VendorOption name="conflictResolution">false</VendorOption>
        <VendorOption name="maxDisplacement">20</VendorOption>

Here is answer to my question


it is NOT POSSIBLE to do multiline label with <sld:VendorOption name="followLine">true</sld:VendorOption> :( Disabling this option and using sld:LabelPlacement makes it work, but the label is not following the line.


I solved this with some CDATA and a zero-width space, like this;


What you can't see above is the zero-width space character immediately after the CDATA[. Search 'copy zero width space to clipboard' to help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.