[Geoserver-devel] SLD GetLegendGraphic

Hi,

Does anyone know how to get labels in the legend using SLDs, and also why graphics returned seem to get squashed if there is more than one symbol. The legend graphic I have attached is the result of an SLD that uses for different coloured stars.

Regards
Gus MacAulay

(attachments)

badLegendGraphic.png
absamp3.sld (5.1 KB)

Hi Gus,

I am a little confused as to what is going wrong, but I might be able to help a little:

Your filters are all using 'less than', so if you have a value of say 0, then all of your rules will be used, and possibly all of the stars will be rendered in the same spot. You could try the <PropertyIsEqualTo> filter tag to render one at a time.
The stars might be squished because they are all trying to fit into the same square, because all of the rules succeeded. I don't know exactly how the labels are rendered, but it might do something like that. I wouldn't think that that is the desired output, but the spec should say.
Try removing all but one rule and see if the star is still squished.

Now as for getting labels in the legend, are you talking about the legend in the map preview page of GeoServer? Or some other legend? The map preview page uses MapBuilder as the interface and the legend shows each layer. In your SLD, you only have one layer, but have restrictions on what will be rendered in that layer. So MapBuilder will only show the one layer in the legend. And I don't think you can customize what the legend icon looks like with SLD. But I could be wrong. You should ask the MapBuilder list (mapbuilder-users@lists.sourceforge.net), they should be able to help you.

Brent Owens
(The Open Planning Project)

Gus MacAulay wrote:

Hi,

Does anyone know how to get labels in the legend using SLDs, and also why graphics returned seem to get squashed if there is more than one symbol. The legend graphic I have attached is the result of an SLD that uses for different coloured stars.

Regards
Gus MacAulay

------------------------------------------------------------------------