This is a great trick, and may be useful elsewhere. Thanks
> [The  if (gpolygons[a])  and  gpolygons[a] = false;  are defensive
> coding, to prevent any possibility of calling removeOverlay twice on the
> same polygon.]

On May 6, 6:21 am, Mike Williams <[email protected]> wrote:
> That code creates a new GPoygon that's similar to the original one and
> tries to remove that from the map, which fails because it was never
> addOverlay()ed.
>
> What you have to do is keep global references to all your GPolygons.
>
> var gpolygons = [];     // Global
>
> ...
>    map.addOverlay(fall);
>    gpolygons[a] = fall;
>
> ...
>
> else {
>   for (var a = 0; a < fallow.length; a++) {
>     if (gpolygons[a]) {
>       map.removeOverlay(gpolygons[a]);
>       gpolygons[a] = false;
>     }
>   }
>
> }
>
> [The  if (gpolygons[a])  and  gpolygons[a] = false;  are defensive
> coding, to prevent any possibility of calling removeOverlay twice on the
> same polygon.]
>
> --http://econym.org.uk/gmap
> The Blackpool Community Church Javascript Team

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to