Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

The GetLegendGraphic request works well. I display the legend at a fixed position in my viewer using OpenLayers. But I would like to know if there is any way to add some custom text to the legend.

The legend that geoserver produces is like this: http://docs.geoserver.org/latest/en/user/_images/samplelegend.png

But I need to produce a legend with a title: http://minus.com/m4AP102Jj

Does anyone know if the GetLegendGraphic request in GeoServer, or the SLD style have a way to add this?

UPDATE (23/08/12)

For now I´ll use a litle trick to add a title by adding in my SLD another custom rule above all others that not match any other rules:

Example:

<sld:Rule>
  <sld:Name>[NAME]</sld:Name>
    <sld:Title>[TITLE]</sld:Title>
    <ogc:Filter>
      <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>[PROPERTY_NAME]</ogc:PropertyName>
        <ogc:Literal>[SOME_VALUE_THAT_NOT_MATCH_OTHER_RULES]</ogc:Literal>
      </ogc:PropertyIsEqualTo>
    </ogc:Filter>
    <sld:PolygonSymbolizer>
      <sld:Fill>
        <sld:CssParameter name="fill">[MATCH_BACKGROUND_COLOR]</sld:CssParameter>
      </sld:Fill>
    </sld:PolygonSymbolizer>      
</sld:Rule>
share|improve this question
add comment

1 Answer 1

http://osgeo-org.1560.n6.nabble.com/Legend-Title-tc4987789.html#none

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

    
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. –  iant Aug 14 '12 at 10:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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