[OpenLayers-Users] Best way to get a legend over a map

Gery . gamejihou at hotmail.com
Wed May 15 12:50:02 PDT 2013


Hi Samuel,

I use attribution (thanks to Phil for the idea), here you have a good example: http://stackoverflow.com/questions/5539633/adding-a-absolutely-positioned-div-to-the-bottom-of-an-openlayers-map/5568762#5568762

Cheers 

Gery

Sent from my iRon

On May 15, 2013, at 20:08, "Samuel Gilbert" <samuel.gilbert at ec.gc.ca> wrote:

Hello,

I'm using OpenLayer to display forecasted air pollutant concentrations and 
rain from radar scans.  The layers I display are therefore color graduated.  I 
would like to add a color scale to the map to make the correspondence between 
the color and the forecasted concentration or rain intensity.  Since the 
application will be used in full-screen mode, I would like the legend to float 
over the map like the zoom controls.

The WMS GetCapabilities does list styles from the layers and contains 
LegendURL elements with links to the actual resource.

"Format/WMSCapabilities/v1_1.js" defines the function GetLegendGraphic, but 
it's not used anywhere else in the OpenLayer(version 2.12) code.

What would be the best way to add the legend over the map?  I could copy and 
modify "Control/Attribution.js", but is there a better way to do this?  Also, 
ideally I would like to make a link with the currently displayed layer and the 
retrieval and display of the legend.

Cheers,

Samuel
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130515/8b2d5e00/attachment.html>


More information about the Users mailing list