My mistake. The points will need to loaded as points, not as numbers. I have set up a simple example; http://srsz750.appspot.com/api3/fitbounds.html
If you change the size of the window and refresh the map you will notice that map will change so all points are in the display area. On Apr 11, 10:53 pm, sb <[email protected]> wrote: > var myBounds = new google.maps.LatLngBounds(); > myBounds.extend(25.774252, -80.190262); > myBounds.extend(18.466465, -66.118292); > myBounds.extend(L32.321384, -64.7573); > map.fitBounds(myBounds); > > This should work. > > On Apr 10, 4:55 pm, knospe <[email protected]> wrote: > > > > > > > > > What do I have to do to auto-fill the zoom and the center according to > > the coords of the polygon? > > > How do I get > > > "var myLatLng = new google.maps.LatLng(24.886436490787712, > > -70.2685546875);" > > and > > "zoom: 5," > > automatically? > > > google's example code: > > > function initialize() { > > var myLatLng = new google.maps.LatLng(24.886436490787712, > > -70.2685546875); > > var myOptions = { > > zoom: 5, > > center: myLatLng, > > mapTypeId: google.maps.MapTypeId.TERRAIN > > }; > > > var bermudaTriangle; > > > var map = new google.maps.Map(document.getElementById("map_canvas"), > > myOptions); > > > var triangleCoords = [ > > new google.maps.LatLng(25.774252, -80.190262), > > new google.maps.LatLng(18.466465, -66.118292), > > new google.maps.LatLng(32.321384, -64.75737), > > new google.maps.LatLng(25.774252, -80.190262) > > ]; > > > // Construct the polygon > > // Note that we don't specify an array or arrays, but instead just > > // a simple array of LatLngs in the paths property > > bermudaTriangle = new google.maps.Polygon({ > > paths: triangleCoords, > > strokeColor: "#FF0000", > > strokeOpacity: 0.8, > > strokeWeight: 2, > > fillColor: "#FF0000", > > fillOpacity: 0.35 > > }); > > > bermudaTriangle.setMap(map); > > > } -- 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.
