[Geoserver-devel] Redundant styles in GetLegendGraphic for layergroup

Hi Mauro & all,

I noticed that if multiple layers in a layergroup GetLegendGraphic use the same default style, that style is rendered redundantly for each layer instead of only once. In our case, this is a layergroup that contains multiple bathymetry tifs using the same style.

It seems like each unique style/rule combination should only be rendered once. In this case each style would potentially have multiple layer titles, maybe sorted and stacked vertically above the legend. Also, there are several places in the code where the layer is evaluated when making rendering decisions. For these decisions, would it be sufficient to just use the first layer in the set using that style/rule combination?

If those few issues can be decided, it seems fairly straightforward to implement this. Mauro, any thoughts? Are you interested in making these tweaks, or would you rather I took a stab at it?

Thanks,
Shane


Shane StClair
Software Engineer
Axiom Consulting & Design
http://www.axiomalaska.com

Oh, and one other issue with redundant styles in layergroup GetLegendGraphic: when a style is rendered redundantly, the name of the last layer gets used in all of the renderings.

Best,
Shane

···

On Fri, Apr 12, 2013 at 1:49 AM, Shane StClair <shane@anonymised.com.2677…> wrote:

Hi Mauro & all,

I noticed that if multiple layers in a layergroup GetLegendGraphic use the same default style, that style is rendered redundantly for each layer instead of only once. In our case, this is a layergroup that contains multiple bathymetry tifs using the same style.

It seems like each unique style/rule combination should only be rendered once. In this case each style would potentially have multiple layer titles, maybe sorted and stacked vertically above the legend. Also, there are several places in the code where the layer is evaluated when making rendering decisions. For these decisions, would it be sufficient to just use the first layer in the set using that style/rule combination?

If those few issues can be decided, it seems fairly straightforward to implement this. Mauro, any thoughts? Are you interested in making these tweaks, or would you rather I took a stab at it?

Thanks,
Shane


Shane StClair
Software Engineer
Axiom Consulting & Design
http://www.axiomalaska.com


Shane StClair
Software Engineer
Axiom Consulting & Design
http://www.axiomalaska.com

2013/4/12 Shane StClair <shane@anonymised.com>

Hi Mauro & all,

I noticed that if multiple layers in a layergroup GetLegendGraphic use the
same default style, that style is rendered redundantly for each layer
instead of only once. In our case, this is a layergroup that contains
multiple bathymetry tifs using the same style.

It seems like each unique style/rule combination should only be rendered
once.

I don't know if this is the correct behaviour. In my opinion the legend
should list each layer with its style, also if they are identical, by
default. Maybe we cound add a legend option (something like
groupByStyle=true) to introduce the behaviour you describe on demand. Any
other opinions?

In this case each style would potentially have multiple layer titles,
maybe sorted and stacked vertically above the legend. Also, there are
several places in the code where the layer is evaluated when making
rendering decisions. For these decisions, would it be sufficient to just
use the first layer in the set using that style/rule combination?

If those few issues can be decided, it seems fairly straightforward to
implement this. Mauro, any thoughts? Are you interested in making these
tweaks, or would you rather I took a stab at it?

I don't know if I can find time to implement that, but if you can submit a

patch, I can make a review.

Thanks.
Mauro
--

GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.

Dott. Mauro Bartolomeoli
@mauro_bart
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

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

This could be a bug.

Could you open a jira issue for that with enough info to reproduce it?

···

Thanks
Mauro

2013/4/12 Shane StClair <shane@anonymised.com.2677…>

Oh, and one other issue with redundant styles in layergroup GetLegendGraphic: when a style is rendered redundantly, the name of the last layer gets used in all of the renderings.

Best,
Shane

==
GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.

Dott. Mauro Bartolomeoli
@mauro_bart
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Fri, Apr 12, 2013 at 1:49 AM, Shane StClair <shane@anonymised.com> wrote:

Hi Mauro & all,

I noticed that if multiple layers in a layergroup GetLegendGraphic use the same default style, that style is rendered redundantly for each layer instead of only once. In our case, this is a layergroup that contains multiple bathymetry tifs using the same style.

It seems like each unique style/rule combination should only be rendered once. In this case each style would potentially have multiple layer titles, maybe sorted and stacked vertically above the legend. Also, there are several places in the code where the layer is evaluated when making rendering decisions. For these decisions, would it be sufficient to just use the first layer in the set using that style/rule combination?

If those few issues can be decided, it seems fairly straightforward to implement this. Mauro, any thoughts? Are you interested in making these tweaks, or would you rather I took a stab at it?

Thanks,
Shane


Shane StClair
Software Engineer
Axiom Consulting & Design
http://www.axiomalaska.com


Shane StClair
Software Engineer
Axiom Consulting & Design
http://www.axiomalaska.com