This issue seems simple but I haven't been able to figure it out for some days now: How can I get the google.maps.Map object for the map that was created by GMap?

This seems like the correct approach, but it doesn't seem to work:

var map = Drupal.gmap.getMap( 'auto1map' );
map.getCenter(); // => "TypeError: Object [object Object] has no method 'getCenter'"

Comments

podarok’s picture

Version: 7.x-2.2 » 7.x-2.x-dev
Component: Code » Miscellaneous

tag

jkingsnorth’s picture

I'm also stuck on this issue at the moment, can anyone advise?

jkingsnorth’s picture

Status: Active » Fixed

I found the solution here #541866: Javascript getCurrentLocation and GMap? in #8.

var tester = Drupal.gmap.getMap('auto1map').map;
tester.getCenter();

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

edison_doulos’s picture

Issue summary: View changes

#3 works for me :) thanks JKingsnorth