Check out the google.maps.LatLngBounds object and the google.maps.Map object's 
fitBounds method.

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:
[email protected]

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

On Jun 24, 2011, at 9:43 AM, InfoMail InfoMail wrote:

> I'd like to set map bounds (i.e. a setZoom + setCenter) in order to be 
> included in a given box.
> Let's have a fixed center,
>  
> function includeBounds(minLat, minLng, maxLat, maxLng) {
>  
>     var center = new google.maps.LatLng((minLat + maxLat) / 2, (minLng + 
> maxLng) / 2);
>     var zoom = someMagicFunction(center, minLat, minLng, maxLat, maxLng);
>  
>     map.setCenter(center);
>     map.setZoom(zoom);
>    
>     at this point I'd like to have the map centered in 'center' and with a 
> zoom level such
>     that map.getBounds() are INCLUDED in the box defined by [minLat, minLng] 
> - [maxLat, maxLng]
> }
>  
> Any idea?
> Many thanks in advance!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Google Maps JavaScript API v3" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/google-maps-js-api-v3/-/ibpzPZ0_7xwJ.
> 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.

-- 
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.

Reply via email to