With Google Maps I can enter a single lat/lng coordinate and the map is drawn with that lat/lng in the center.
What I'd like to be able to do is enter two coordinate pairs, say the southwest coordinate and the northeast coordinate, and have a Google Map displayed with the appropriate zoom so that the map fills the bounds defined by those coordinates.
Is this possible? If so, how?
Thanks
And the Answer is... Go to Google Maps Code Playground!
Per Taylor's suggestion, I went to the Google Maps Code Playground and entered the following code and was able to get a centered map with the appropriate zoom level bounded by the coordinate pair.
function initialize() {
var mapDiv = document.getElementById('map-canvas');
var map = new google.maps.Map(mapDiv, {
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var southWest = new google.maps.LatLng(..., ...);
var northEast = new google.maps.LatLng(..., ...);
var bounds = new google.maps.LatLngBounds(southWest,northEast);
map.fitBounds(bounds);
}