[OpenLayers-Users] Remove Layer not working

GNR Revolution dieconnex at hotmail.com
Tue Feb 14 08:09:11 EST 2012


Hi there,

I'm fairly new to Openlayers, and I am having a problem that I cannot figure
out so hoping someone can enlighten me.  Basically I have a button that I
wish to use to add or remove a control (in this case a legend image) to the
map.  The adding works fine, but even though I hit the removecontrol element
of the code nothing happens, can anyone explain why?  Code snippet is below,
called by the button trigger:

	function GetLegendState() {
		if (bLegendState == false) 
			{
        		map.addControl (Legend);
			bLegendState = true;
			}
		else if (bLegendState == true) 
			{
			map.removeControl (Legend);
			bLegendState = false;
			}
		else
			{
			}
           }

The else if element is being reached (tested via alert) but the
map.removeControl (Legend) doesn't seem to do anything?

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Remove-Layer-not-working-tp4468764p4468764.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list