Have a look at the LatLngBounds object and using map.fitBounds.

http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLngBounds
http://code.google.com/apis/maps/documentation/javascript/reference.html#Map

-- Luke


On Wed, Jun 22, 2011 at 6:21 AM, bnazza <[email protected]> wrote:

> I want to create a map, add a number of markers, let's say 10 and then have
> the map center and zoom so that the markers "fill" the map.
>
> The only way I can think to do this at the moment is to calculate the
> northernmost and southernmost latitude co-ordinates, the easternmost and
> westernmost longitude co-ordinates and figure a center co-ordinate from
> there.
>
> Is there an easier way to achieve this in V3?
>
> --
> 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/-/xR5h5jC5VJMJ.
> 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