By looking at your code example it looks like you want to set the center *and* zoom at the same time? If that's the case, here's what you'd do:
var center = new google.maps.LatLng(-25.2744 , 133.775 ); map.setZoom(10); map.setCenter(center); setCenter() only accepts a LngLat object, not an optional zoom level. If you are more interested in zooming to a particular area, look into map.fitBounds() on here: http://code.google.com/apis/maps/documentation/v3/reference.html#Map Hope that helps. On Mar 11, 9:21 am, TTA <[email protected]> wrote: > Hi all, > I'm new to google maps. I'm trying to center to a particular location > using latitude and longitude as mentioned below > > center = new google.maps.LatLng(-25.2744 , 133.775 ); > map.setCenter(center, 10); > > But it does not give best result/view with a fixed zoom value for > other coordinates. > > Is there any way or logic to calculate viewport using a single > coordinate? > > Please help. > > Thanks > -TTA -- 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.
