This was a great solution Larry. Thank you so much for your help. On Oct 5, 12:49 am, "[email protected]" <[email protected]> wrote: > On Oct 4, 7:47 pm, Bryan Richardson <[email protected]> wrote: > > > Ah yes, the fact that Maps v3 is event-based explains my > > problem. I must have missed that piece of the documentation... > > It is not obvious. But has come up in discussions with the Google > Engineers that frequent this group. > > > thanks for the help! > > > As for only limiting the zoom level to 12 the first time, do you > > suggest I accomplish this via a global JavaScript variable, or > > via some other means? > > I found that I needed two flags. It seems like it is 48 first then > 12, so it takes a couple of zoom change events to get it right. > > I did something like this: > google.maps.event.addListener(map, "zoom_changed", function() { > var desiredZoom = 12; > if (initializing && (map.getZoom() == desiredZoom)) { > initializing = false; > } else if (initializing && (map.getZoom() > desiredZoom)) { > map.setZoom(desiredZoom); > } > > }); > > -- Larry > > > > > > > -- > > Thanks! > > Bryan > > > On Oct 4, 12:44 am, "[email protected]" <[email protected]> > > wrote: > > > > On Oct 3, 11:34 pm, "[email protected]" <[email protected]> > > > wrote: > > > > > On Oct 3, 12:59 pm, Bryan Richardson <[email protected]> wrote: > > > > > > Hi Larry, > > > > > > Thanks for responding. Sorry it took me so long to get back to > > > > > this, hopefully you're still willing to help! > > > > > > You're right, I did have the zoom levels backwards. I've changed > > > > > my code to reflect the correct way, and have posted an example > > > > > at the following link. > > > > > >http://erum-staging.heroku.com/mapfix.html > > > > > > Let me know what you think! > > > > > The v3 google maps API is event based. Most of the properties of the > > > > map (like zoom, projection, bounds,...) aren't available until the map > > > > initialization is complete. > > > > > You need to do something like: > > > > google.maps.event.addListener(map, "zoom_changed", function() { > > > > if (map.getZoom() > 12) { > > > > map.setZoom(12); > > > > } > > > > Although you probably only want it the first time, not always limited > > > to be less than 12. > > > > -- Larry > > > > > }); > > > > > -- Larry > > > > > (still lobbying for a "map initialization complete event...) > > > > > > -- > > > > > Thanks! > > > > > Bryan > > > > > > On Aug 20, 11:38 pm, "[email protected]" <[email protected]> > > > > > wrote: > > > > > > > On Aug 20, 3:48 pm, Bryan Richardson <[email protected]> wrote: > > > > > > > > Hello All, > > > > > > > > I'm adding LatLng objects to a LatLngBounds object via the > > > > > > > extend() > > > > > > > method such that I can have my Google map include all the LatLng > > > > > > > objects via map.fitBounds(). However, my problem is when the > > > > > > > LatLngBounds object just includes a few points that are very close > > > > > > > together. I want my minimum zoom level to be 4, but there's times > > > > > > > when > > > > > > > the points are so close together that the zoom level is 1 or 2. > > > > > > > That sounds wrong, zoom level 0 is the whole world. > > > > > > > > I > > > > > > > tried checking the zoom level via getZoom after fillBounds is > > > > > > > called, > > > > > > > but it returns undefined. > > > > > > > Sounds like your map variable needs to be global. > > > > > > > > I've now been trying to figure out how to > > > > > > > set the minZoom property for MapType, but can't figure out how to > > > > > > > do > > > > > > > that either... :( > > > > > > > > Any suggestions on how to address my problem?! > > > > > > > Post a link to your map that exhibits the problem. > > > > > > > -- Larry > > > > > > > > -- > > > > > > > Thanks! > > > > > > > Bryan
-- 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.
