Is there any possibility to construct SLD style which displays label with rectangular background?

Background has to have sizes which automatically fit to sizes of text content. I would prefer not to use any vendor parameters because SLD has to be used in more than one application.

This is an example of desired label generated in QGIS (unfortunately QGIS doesn't export label specification from this label configuration):

enter image description here

  • Have you tried a <Halo> inside your <TextSymbolizer>? – Ralph Dell Dec 19 '13 at 15:31

I know you specified you would rather not use vendorparameters, but this is the only way I know how to do it. I'm not sure if you have tried this already.

Add a square graphic to the textsymbolizer and use the vendoroptions graphic-resize and graphic-margin.

          <CssParameter name="font-weight">bold</CssParameter>
          <CssParameter name="font-size">15</CssParameter>
          <CssParameter name="fill">#FFFFFF</CssParameter>
          <CssParameter name="fill">#DE230A</CssParameter>                  
        <VendorOption name="graphic-resize">stretch</VendorOption>                         
        <VendorOption name="graphic-margin">2</VendorOption>             

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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