Hey all, I'm relatively new and have met my match with google maps api/drupal gmap and was hoping for an assist.

I'm trying to find the minimum and maximum latitude and longitude for my map at a given time. I see that the newest version of the google maps api exposes the getBounds() function but it is not recognized as a function when I try to use it as such.

var mymap = Drupal.gmap.getMap('myMap');
var bounds = mymap.getBounds();

Can someone please help point me in the right direction?

Thanks!
Jason

Comments

jchuck5612’s picture

Status: Active » Closed (fixed)

Silly me... I found it. Just took 24 hours.

sanjith’s picture

hey Please tell me.. How u done it ?

Anonymous’s picture

Yes please, I'm trying to figure out how to do the same thing but I'm very new to Drupal and javascript

Anonymous’s picture

var map = obj.map;
var bounds = map.getBounds();
var southWest = bounds.getSouthWest();
var northEast = bounds.getNorthEast();
var minLat = southWest.lat();
var maxLat = northEast.lat();
var minLon = southWest.lat();
var maxLon = northEast.lat();