My favorite way to achieve this is to include my markers as a KML
overlay. From 
http://code.google.com/apis/maps/documentation/javascript/overlays.html#KMLLayers:
"By default, when displaying a KmlLayer, the map is zoomed and
positioned to show the entirety of the layer's contents."

ES

On Jun 21, 10:24 pm, Luke Mahé <[email protected]> wrote:
> Have a look at the LatLngBounds object and using map.fitBounds.
>
> http://code.google.com/apis/maps/documentation/javascript/reference.h...http://code.google.com/apis/maps/documentation/javascript/reference.h...
>
> -- 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