1

I'm using the GeoServer WMS to display some raster data with a custom color ramp. When I request a legend using GetLegendGraphic, I get a legend entry with a big red X in it:

color ramp

Is there any way I can get a legend graphic with this X omitted? Here's my SLD:

  <sld:RasterSymbolizer>
    <sld:ColorMap>
      <sld:ColorMapEntry color="#ffffe5" opacity="0" quantity="0"/>
      <sld:ColorMapEntry color="#ffffe5" opacity="1" quantity="0"   label="0 mm"  />
      <sld:ColorMapEntry color="#f7fcb9" opacity="1" quantity="25"  label="25 mm" />
      <sld:ColorMapEntry color="#d9f0a3" opacity="1" quantity="50"  label="50 mm" />
      <sld:ColorMapEntry color="#addd8e" opacity="1" quantity="100" label="100 mm"/>
      <sld:ColorMapEntry color="#78c679" opacity="1" quantity="150" label="150 mm"/>
      <sld:ColorMapEntry color="#41ab5d" opacity="1" quantity="200" label="200 mm"/>
      <sld:ColorMapEntry color="#238443" opacity="1" quantity="250" label="250 mm"/>
      <sld:ColorMapEntry color="#006837" opacity="1" quantity="300" label="300 mm"/>
      <sld:ColorMapEntry color="#004529" opacity="1" quantity="400" label="400 mm"/>
    </sld:ColorMap>
    <sld:ContrastEnhancement/>
  </sld:RasterSymbolizer>

(The opacity=0 ColorMapEntry is there to prevent NODATA pixels from being displayed.)

1

That is representing your NODATA value, if you leave that out of the style there will be no X in the legend.

If it really bothers you then you could propose an enhancement to GeoServer's legend graphic code after you have read this guide.

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.