[Geoserver-users] Dynamic GetLegendGraphic

Hello list!

Altough the GetLegendGraphic functionality works great for simple
cases/layers/layergroups there are some shortcomings when dealing with
more complex layer(groups).

I'm in a phase where I consider wether GetLegendGraphic as implemented
by Geoserver meets my needs, and the possibility of improving it.

My main wish for the GetLegendGraphic is to make it "dynamic", i.e.
supply it a bbox (and map with/height?) as in GetMap, and get back a
legend consisting of just the features available on the given are (so
that the legend matches the part of the map the user currently sees).

I haven't found any previous discussions on this, sorry if I have
overlooked any. In my mind this seems like a rather simple task:
- Geoserver has code for getting features at a given area (used in
GetMap)
- Geoserver supports rendering of legend entries

I guess the main issue is combining these in a simple and (rather) fast
manner, so that GetLegendGraphic is performant.

When it comes to implementation my java skills are severly lacking and I
am not familiar with the Geoserver codebase, but given some pointers and
guidance I guess I could try. Another option I'm considering is
sponsoring the development of this, but in order to justify this I need
some (guess/est)imates on time/complexity of the task, and of course I
need someone (with knowledge of WMS in Geoserver) to take on the task.
Please not that I am just asking for some ballpark figures, and if this
is something that (if funded) would be considered added to Geoserver.

So, any comments, pointers, and esitmates welcome!

Best Regards
Atle F. Sveen

--
  Atle Frenvik Sveen
  atle@anonymised.com
  45278689
  atlefren.net

On Tue, Sep 20, 2016 at 1:00 PM, Atle Frenvik Sveen <atle@anonymised.com>
wrote:

When it comes to implementation my java skills are severly lacking and I
am not familiar with the Geoserver codebase, but given some pointers and
guidance I guess I could try.

The simplest approach is probably to:

   - Add the bbox, srs to the GetLegendGraphic request object as a
   https://github.com/geoserver/geoserver/blob/master/src/wms/src/main/java/org/geoserver/wms/GetLegendGraphicRequest.java
   (the scale denominator is already an existing parameter, and width/height
   have a different meaning by spec, so I'm not sure about adding a different
   set of width/height, some consideration should be done about pros/cons of
   each choice)
   - Modify
   https://github.com/geoserver/geoserver/blob/master/src/wms/src/main/java/org/geoserver/wms/legendgraphic/BufferedImageLegendGraphicBuilder.java
   to count how many features match a rule own filter along with the correct
   bbox one (which has to be expressed in the source CRS, and take into
   account eventual map wrapping), if the count is zero, discard the rule

The changes need to be packaged as a pull request, following these rules:

https://github.com/geoserver/geoserver/blob/master/CONTRIBUTING.md

You can also check this guide, but given the mail, you might have already
read it:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Another option I'm considering is
sponsoring the development of this, but in order to justify this I need
some (guess/est)imates on time/complexity of the task, and of course I
need someone (with knowledge of WMS in Geoserver) to take on the task.
Please not that I am just asking for some ballpark figures, and if this
is something that (if funded) would be considered added to Geoserver.

I believe this is something that would be quite welcomed. Sponsoring wise,
we normally do
not provide quotes in public, but you can ask directly to any of these
companies:
http://geoserver.org/support/

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

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

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

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

Hi and thanks for the swift response!

It seems very clear to me that if this feature is to be implemented is
has to be done in cooperation with the Geoserver community, as there are
a lot of options for implementing this.

It is anyways good to hear that this is

a) a feature that is most likely welcome
b) a feature that seems absolutely possible to implement

Regarding quotes I understand that this is not done in public, and I
will follow this up in appropriate channels if I consider this route.

-atle

--
  Atle Frenvik Sveen
  atle@anonymised.com
  45278689
  atlefren.net

On Tue, Sep 20, 2016, at 01:56 PM, Andrea Aime wrote:

On Tue, Sep 20, 2016 at 1:00 PM, Atle Frenvik Sveen
<atle@anonymised.com>
wrote:

> When it comes to implementation my java skills are severly lacking and I
> am not familiar with the Geoserver codebase, but given some pointers and
> guidance I guess I could try.

The simplest approach is probably to:

   - Add the bbox, srs to the GetLegendGraphic request object as a
   https://github.com/geoserver/geoserver/blob/master/src/wms/src/main/java/org/geoserver/wms/GetLegendGraphicRequest.java
   (the scale denominator is already an existing parameter, and
   width/height
   have a different meaning by spec, so I'm not sure about adding a
   different
   set of width/height, some consideration should be done about pros/cons
   of
   each choice)
   - Modify
   https://github.com/geoserver/geoserver/blob/master/src/wms/src/main/java/org/geoserver/wms/legendgraphic/BufferedImageLegendGraphicBuilder.java
   to count how many features match a rule own filter along with the
   correct
   bbox one (which has to be expressed in the source CRS, and take into
   account eventual map wrapping), if the count is zero, discard the rule

The changes need to be packaged as a pull request, following these rules:

https://github.com/geoserver/geoserver/blob/master/CONTRIBUTING.md

You can also check this guide, but given the mail, you might have already
read it:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

> Another option I'm considering is
> sponsoring the development of this, but in order to justify this I need
> some (guess/est)imates on time/complexity of the task, and of course I
> need someone (with knowledge of WMS in Geoserver) to take on the task.
> Please not that I am just asking for some ballpark figures, and if this
> is something that (if funded) would be considered added to Geoserver.
>

I believe this is something that would be quite welcomed. Sponsoring
wise,
we normally do
not provide quotes in public, but you can ask directly to any of these
companies:
http://geoserver.org/support/

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

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

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely
for
the attention and use of the named addressee(s) and may be confidential
or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure,
reproduction,
copying, distribution, or either dissemination, either whole or partial,
is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy
or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

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