How destroy map object

14,789 views
Skip to first unread message

Saint Byte

unread,
Aug 7, 2011, 7:53:23 AM8/7/11
to Google Maps JavaScript API v3
I have web application with google maps api v3/ i make map like:

var myOptions = {
zoom: 5,
center: new google.maps.LatLng(60.397,59.644),
mapTypeId: google.maps.MapTypeId.HYBRID
};
var map = new google.maps.Map($('photoimg'), myOptions);

And for ofter task i need back div ( $('photoimg') ) . How destroy
map ?

Chris Broadfoot

unread,
Aug 10, 2011, 1:17:21 AM8/10/11
to google-map...@googlegroups.com
Unfortunately, there is no functionality to do this in the Maps API. Could you please tell us a bit more about your use case?

The closest thing to what you want is achieved by deleting the DOM element used as the container.


--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Jeremy Geerdes

unread,
Aug 10, 2011, 1:26:59 AM8/10/11
to google-map...@googlegroups.com
You can destroy the map on your own with three steps:

  • Eliminate all references to the map but one.
  • Call delete(map); where map is the last reference to your map.
  • Remove the children from the parent element.

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

winge...@gmail.com

unread,
Oct 21, 2015, 6:07:22 PM10/21/15
to Google Maps JavaScript API v3
Hello.

Our typical use case is switching language in single-page-application. 

We're using map and address autocomplete feature. But we're unable to change language without re-loading.

Winger

Dne středa 10. srpna 2011 7:17:21 UTC+2 Chris Broadfoot (Google Employee) napsal(a):
Unfortunately, there is no functionality to do this in the Maps API. Could you please tell us a bit more about your use case?

The closest thing to what you want is achieved by deleting the DOM element used as the container.

On Sun, Aug 7, 2011 at 9:53 PM, Saint Byte <ad...@dotsb.net.ru> wrote:
I have web application with google maps api v3/ i make map like:

var myOptions = {
                       zoom: 5,
                      center: new google.maps.LatLng(60.397,59.644),
                       mapTypeId: google.maps.MapTypeId.HYBRID
                       };
var map = new google.maps.Map($('photoimg'), myOptions);

And for ofter task i need back div ( $('photoimg') ) . How destroy
map ?

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-api-v3+unsub...@googlegroups.com.

Trent Clowater

unread,
Nov 9, 2016, 5:29:08 PM11/9/16
to Google Maps JavaScript API v3, winge...@gmail.com
Hello,

Our use case is very similar. We are also using the maps API together with the geocoding API to do reverse geocoding for address lookup used in translations of our model data. It seems that google.maps.Geocoder does not support the language parameter that is supported by accessing the API directly via HTTP request, so we ended up making an AJAX call with the language parameter we wanted.
Reply all
Reply to author
Forward
0 new messages