Thanks for this! I was thinking of doing something similar. I'm going to try to get the bounds on the server side and pass them to the client.
On Nov 10, 11:38 am, Tony <[email protected]> wrote: > Try following psuedo code > > var bounds = new google.maps.LatLngBounds(); > var points = []; > var point; > var polygon; > > //Create array of points defining your polygon > for each point on your polygon... > point = new google.maps.LatLng(<lat>,<lng>); > bounds.extend(point); > points.push(point): > > polygon = new google.maps.Polygon({ > paths: points, > strokeColor: "#FF0000", > strokeOpacity: 0.8, > strokeWeight: 2, > fillColor: "#FF0000", > fillOpacity: 0.35 > }); > > polygon.setMap(map); > > //Then fit the map to your bounds object > map.fitBounds(bounds); > > On Nov 10, 3:27 pm, hvr <[email protected]> wrote: > > > > > Hi There, > > > I'm trying to dynamically draw a polygon on my map and i want to set > > the zoom level so that no matter what the shape/size of the polygon it > > will always be fully shown on the map. I've found instructions on how > > to do this in V2 of the api but it seem that certain methods are > > missing in V3. is there a new way to do this or has the functionality > > not been added yet? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
