Hey, new experimenter here.. and I am struggling with the ability to
get the size of my map box. Eventually I plan to interrogate my db to
see what markers to display as the user scrolls around. For now I am
just trying to get the bounds of the map. I suspect it is something
really basic but my brain is fried.
All the examples I can find are v2 but the v3 ref for the function
looks like it is unchanged so I am using the same syntax. the code is
below. I am receiving the "bounds is undefined" error as soon as I try
to use the bounds variable.
For convenience I have the page online at:
http://www.markbsplace.net/test/test.htm
function initialize() {
var latlng = new google.maps.LatLng(40.69847032728747,
-73.9514422416687);
var mapOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("Map"),
mapOptions);
bounds = map.getBounds();
southWest = bounds.getSouthWest();
northEast = bounds.getNorthEast();
lngSpan = northEast.lng() - southWest.lng();
latSpan = northEast.lat() - southWest.lat();
}
any help or pointer to v3 example would be greatly appreciated!
Mark