I've got some Javascript/HTML code which displays a variable number of maps dependent on what the user selects.
I've worked how to dynamically create multiple maps on a page - that's well documented.
However, what I'm not so sure on is... how can I safely destroy a map after it's been created - normally I just leave this to GUnload() to sort out.
Thanks for any help!
I've got some Javascript/HTML code which displays a variable number of maps dependent on what the user selects.
I've worked how to dynamically create multiple maps on a page - that's well documented.
However, what I'm not so sure on is... how can I safely destroy a map after it's been created - normally I just leave this to GUnload() to sort out.
Thanks for any help!
Share Improve this question edited Dec 22, 2009 at 21:40 Daniel Vassallo 345k72 gold badges512 silver badges446 bronze badges asked Nov 18, 2009 at 16:33 StuartStuart1 Answer
Reset to default 3Unfortunately the Google Maps API does not yet provide a documented method to GUnload()
a single map.
There is an open Issue #772 for this feature on the Google Maps API Issue Tracker. On May 24 2009 it was marked as Acknowledged, but it remains open to this day.
In the first ment of that issue, a Google Maps team member confirmed that a possible "partial" workaround at the moment is to call:
map_to_delete.clearOverlays();
GEvent.clearInstanceListeners(map_to_delete);