[OpenLayers-Users] Remove Layer not working

Steve Nelson snelson at webapper.com
Mon Mar 26 11:30:21 EDT 2012


I'm running into this same problem. Did you find a solution to this?

Steve

On Tue, Feb 14, 2012 at 8:09 AM, GNR Revolution <dieconnex at hotmail.com>wrote:

> 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.
> _______________________________________________
> 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/20120326/2f46cedc/attachment.html


More information about the Users mailing list