[OpenLayers-Users] Display legend

Sophie GRAS sophie.gras at espaces-naturels.fr
Fri Oct 17 03:33:11 EDT 2008


thanks for your help but the legend is not displayed... 
i get the following error message : 
msEvalRegex(): Regular expression error 
Do you have any idea why ? 

----- Mail Original ----- 
De: "Andrew de Klerk" <andrew.deklerk at gmail.com> 
À: "Sophie GRAS" <sophie.gras at espaces-naturels.fr>, "users at openlayers" <users at openlayers.org> 
Envoyé: Mercredi 15 Octobre 2008 17:09:31 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne 
Objet: RE: [OpenLayers-Users] Display legend 

A bit long winded, but we use the “GetLegendGraphic” Request to request the graphic for each class and then place them in a div outside of the map (div could be placed on top of map as well). The "LAYER" is your class name for that particular layer. I cannot recall why we never used GetLegend - there must have been a reason..............but..... this works for us ☺. 

<div id="legend" style="text-align:left; display:none; position:absolute; z-index:777;cursor:pointer; border:1px solid #a9a9a9; background-color:White;"> 
<img src="http://localhost/wms/streetmap.asp?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=Provinces&Format=image/png" alt="" style="border:none;"/><br /> 
<img src="http:// localhost /wms/streetmap.asp?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=Capital_Towns&Format=image/png" alt="" style="border:none;"/><br /> 
<img src="http:// localhost wms/streetmap.asp?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=Major_Towns&Format=image/png" alt="" style="border:none;"/><br /> 
<img src="http:// localhost /wms/streetmap.asp?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=Secondary_Towns&Format=image/png" alt="" style="border:none;"/><br /> 
<img src="http:// localhost wms/streetmap.asp?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=Other_Towns&Format=image/png" alt="" style="border:none;"/><br /> 
<img src="http:// localhost /wms/streetmap.asp?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=Minor_Towns&Format=image/png" alt="" style="border:none;"/><br /> 
</div> 

Andrew 

From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On Behalf Of Sophie GRAS 
Sent: 15 October 2008 04:54 PM 
To: users at openlayers 
Subject: [OpenLayers-Users] Display legend 

Hi everyone 

I have a dumb question but i can't find the answer... 
I have a mapfile with several layers and I use openlayers to display them. 
In each layer I have some classes (representing percentage of the population) and I'd like to know how to display the legend of these classes using openlayers. 
If i embed the legend in the mapfile, it works well but the legend is displayed on each tile. Is there a way to act differently? 

Thanks 

No virus found in this incoming message. 
Checked by AVG - http://www.avg.com 
Version: 8.0.173 / Virus Database: 270.8.0/1721 - Release Date: 10/14/2008 9:25 PM 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081017/ede2e6a6/attachment.html


More information about the Users mailing list