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.

I have geoserver layer with sld style applied. The sld have like 50 rules using type attribute of the feature. Now i need to generate legend but only for specific area (i have bbox coordinates). I am doing this on server side and i can get all the features and their attributes of the choosen area (but i don't have access to style graphics ).

The only way i can think of implementing this is to generate sld style (rules) dynamically and pass it to geoserver as SLD_BODY. It seems a lot of work so I wonder maybe there is a better way of doing this?

Or maybe it is possible to pass some kind of parameter array to getLegendGraphic request like array of features ids or their type?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

There is a proposal (here) that will implement this functionality. Feel free to offer any help you are able to.

share|improve this answer

I'm trying to do something similar because the layer has several unuseful attributes, anyone has found a solution?

(The link above is broken)

share|improve this answer
As far as i remember i ended up with solution i wrote - dynamically creating sld that contained required rules and passing it to getLegendGraphic as SLD_BODY parameter. Not sure what do you mean by attributes (legend entries?) –  gisit Jun 13 '14 at 0:02

Your Answer


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.