[OpenLayers-Users] change legend via layerswitcher selection

D. Eric Keefauver eric.keefauver at mtu.edu
Fri Feb 8 14:10:23 EST 2008


Sorry if this is a double post, I received a delivery failure notice on my
first send:


My javascript is rather rusty but is there a way to change a legend
graphic dynamically (in this case an image tag below that receives its
image via the GetLegendGraphic request) based on the layer selection
within the layerswitcher? More succinctly put, a user selects a layer
named "population per sq mile(2005)" the legend changes respectively.

<img
src="http://optiplexa.mtri.org:8086/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=mtri:v_quality_crosstab&STYLE=polygon_eqi_colormap"
alt="legend" name="legend" style="z-index: 114; left: 18px; width: 81px;
position: absolute; top: 77px; height: 220px;" />

Any direction is greatly appreciated


Eric



More information about the Users mailing list