I don’t think there is a “one-size-fits-all” solution to legends. The WMS 
getlegendgraphic call does all the work of getting you the image of the style 
to display, but you have to do the work with html and js of making dynamic 
legend containers. My effort are, for example: 
https://data.gns.cri.nz/tez/index.html?map=TEZ-Geoscience, but the same code 
drives many websites and maps so code rather too complex to be much help. It 
comes down to things like:
1/ is the legend container always displayed? or is displayed on demand.
2/ is legend graphic always displayed or only when layer is turned on? (in 
which case need to link the img visibility styling to mechanism for turning 
layers on/off).
3/ is legend always meaningful for all layers?
4/ how to handle really massive legends (ie NZ geology legend on that map is 
visible only as a pop-out graphic when show legend chosen from layer context 
menu – and that is the simple version. A full page one is coming up.)

If you look around web, there are many other solutions. Leaflet has a legend 
plugin which is all config driven but not useful in my opinion for WMS legend. 
You need to make some design decisions and then start coding. The geoserver 
component is simply the GetLegendGraphic call. Client-side questions would be 
better directed to more appropriate sources.

From: Endi Soares <[email protected]>
Sent: Friday, 11 September 2020 00:23
To: Vera Green <[email protected]>
Cc: GeoServer Mailing List List <[email protected]>
Subject: Re: [Geoserver-users] About the Geoserver data in leaflet

Hi
I already have the layers on the WEBGIS page, the new challenge is to present 
the styles, present them in legend

I'm a little lost with that

Best Regards

Em qui., 10 de set. de 2020 às 03:14, Vera Green 
<[email protected]<mailto:[email protected]>> escreveu:
In my experience figuring out this plugin is the way to go.
You can get the legend through getFeatureInfo.

https://github.com/heigeo/leaflet.wms



On Wed., Sep. 9, 2020, 5:11 p.m. Endi Soares, 
<[email protected]<mailto:[email protected]>> wrote:
Hi,

I want to consume the Geoserver data in the leaflet, someone has an example 
index.html where I can see the procedures.
If possible with presentation of the legend.

Best regards
--
Endi SoaresGeógrafo
m:(+238) 5809479
a:Praia, Cabo Verdee:
[email protected]<mailto:[email protected]> e: 
[email protected]<mailto:[email protected]>

[Image removed by sender.]<https://www.linkedin.com/in/endi-soares-081ab7105/>
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/geoserver-users


--
Endi SoaresGeógrafo
m:(+238) 5809479
a:Praia, Cabo Verdee:
[email protected]<mailto:[email protected]> e: 
[email protected]<mailto:[email protected]>

[Image removed by sender.]<https://www.linkedin.com/in/endi-soares-081ab7105/>
Notice: This email and any attachments are confidential and may not be used, 
published or redistributed without the prior written consent of the Institute 
of Geological and Nuclear Sciences Limited (GNS Science). If received in error 
please destroy and immediately notify GNS Science. Do not copy or disclose the 
contents.
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to