The concepts from Mike's example still apply to v3 of the API.

You create an instance of google.maps.LatLngBounds:
http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLngBounds

var myBounds=new google.maps.LatLngBounds();

Then use the LatLngBounds extend method to expand it by a marker's
LatLng:

myBounds.extend(myMarker.getPosition());

You'll probably repeat that in a loop as you create your markers.

Finally to fit the map to your markers, use the Map fitBounds method:
http://code.google.com/apis/maps/documentation/javascript/reference.html#Map

myMap.fitBounds(myBounds);

Martin.


On Feb 26, 9:55 am, LarsM <lars.mo...@arxfoto.se> wrote:
> THe* most useful* *Mike Williams'* website has en example that seems to do
> it:
>
> http://econym.org.uk/gmap/basic14.htm
>
> But since it is in API V2 I don't dare to use it.
>
> /LarsM

-- 
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 google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to