Hey,
I just start to learn Google Maps api. I copy the following code
from Google Maps documents to set map bounds and add an alert
statement to display the bounds I just set. However I find that the
getBounds value is different from the value I send to fitBounds().
The value I send to fitBounds() is ((-31.203405,125.244141),
(-25.363882,131.044922))
the value from getBounds is ((-33.13755108,117,86132837),
(-23.28171906,138.4277346))
Is it related to the zoom level set in the map option? If so, how to
control the bounds to latlng values as developers want?
Thanks a lot.
initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var myOptions = { zoom: 4, center: myLatlng, mapTypeId:
google.maps.MapTypeId.ROADMAP }
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
var southWest = new google.maps.LatLng(-31.203405,125.244141);
var northEast = new google.maps.LatLng(-25.363882,131.044922);
var bounds = new google.maps.LatLngBounds(southWest,northEast);
map.fitBounds(bounds);
google.maps.event.addListenerOnce(map, 'idle', function() {
var mBound = this.getBounds();
alert (mBound); });
}
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.