Google Maps in Drupal: reference to gmap object from JavaScript
Posted
by user280817
on Stack Overflow
See other posts from Stack Overflow
or by user280817
Published on 2010-02-25T00:57:26Z
Indexed on
2010/03/13
4:07 UTC
Read the original article
Hit count: 289
Is there a way to obtain JavaScript references to the Google maps that are embedded into Drupal pages by the GMap module? I want to be able to manipulate the maps in these pages. I want to pan and zoom them. But I cannot find a reference to an embedded map object. I've dissected the relevant JavaScript objects Drupal.gmap
and Drupal.settings.gmap
with no success--unless I've overlooked something.
The Drupal GMap module doesn't seem to explicitly provide references (within its API) to the GMap objects that it embeds into pages. It just generates themed text which is interpolated into the page.
The technique of passing the HTML ID of the map container to either the GMap2
object constructor or the similar Drupal.gmap.getMap()
function in order to obtain a map reference doesn't appear to work: Both simply return an instance to a new map, one having the same dimensions and basic characteristics of the original map, but apparently sans all of its overlays (which could contain markers). And I have to call setCenter()
on it before I can use it, which initializes the structure, so I know it has no overlays.
© Stack Overflow or respective owner