onsenjapan wrote: > Thank you...is this possible to do through a function? I'm mainly > using example code and don't know quite what the math required would > be. I have a "bounds" variable but doing something like "bounds = > bounds*1.1" makes the zoom jump out to almost the whole world. > > What would the syntax be for expanding slightly a bounds variable?
something like the below might work: // *** DANGER untested code *** var northEast = bounds.getNorthEast(); northEast = new GLatLng(northEast.lat()+0.005, northEast.lng()+0.005); var southWest = bounds.getSouthWest(); southWest = new GLatLng(southWest.lat()-0.005, southWest.lng()-0.005); bounds.extend(northEast); bounds.extend(southWest); map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)); -- Larry > > On Aug 31, 10:24�pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > onsenjapan wrote: > > > Okay, I've given it some thought and while the zoomOut() solution > > > works, it would be much better if perhaps there was a way to quickly > > > calculate whether the markers are too close to the edges of the map, > > > and -- if so and only if so -- then zoomOut(). �Otherwise, the present > > > method works in about 85 percent of the cases and looks nicer at a > > > closer zoom level. �Any thoughts? > > > > Extend your bounds slightly before using it for the auto zoom > > operation rather than arbitrarily zooming out by one �(move the > > NorthEast corner a little further north and east, and the SouthWest > > corner a little further south and west). > > > > � -- Larry > > > > > > > > > On Aug 31, 2:48 pm, onsenjapan <[EMAIL PROTECTED]> wrote: > > > > I figured this one out. I just wrapped the existing line in the one > > > > you suggested, as so: > > > > > > map.zoomOut(map.setCenter(bounds.getCenter(), > > > > map.getBoundsZoomLevel(bounds))); > > > > > > And now it works fine! Thank you! > > > > > > On Aug 31, 1:49 pm, onsenjapan <[EMAIL PROTECTED]> wrote: > > > > > > > Yes, I was thinking that just zooming out once would be an easy way to > > > > > fix the problem. > > > > > > > I have this line currently: > > > > > > > map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)); > > > > > > > Do you know what to tweak to just shift the zoom one zoomlevel out? > > > > > > > (I tried appending > > > > > > > map.zoomOut(); > > > > > > > to the end and that zoomed all the way out to the very maximum level. > > > > > Oops!) > > > > > > > On Aug 31, 1:22 pm, Andy R <[EMAIL PROTECTED]> wrote: > > > > > > > > 10px, left/right/top/bottom? Is 10px enough for all controls? > > > > > > > > Simple solution: load your markers, adjust position/zoom, then > > > > > > map.zoomOut(); > > > > > > > > On 31 Aug., 19:13, onsenjapan <[EMAIL PROTECTED]> wrote: > > > > > > > > > I was pretty sure this would be easily answered by a search, but I > > > > > > > didn't come up with anything that answered my question. That > > > > > > > probably > > > > > > > means this is so basic that I'm going to say "Dooh!" but I hope > > > > > > > someone will help point me to the right place. > > > > > > > > > I think the problem relates to zoom levels or setting map > > > > > > > bounds...not > > > > > > > sure which. Basically, after I do a search, in certain cases the > > > > > > > marker points show up at the very, very extreme sides of the > > > > > > > map...almost invisible. Sometimes they appear tucked under the > > > > > > > "map" > > > > > > > and "terrain" buttons at the upper right, or under the scale > > > > > > > slider on > > > > > > > the left. I would like to simply add a function that will extend > > > > > > > the > > > > > > > map border by 10 more pixels or lat/lng points or zoom levels or > > > > > > > whatever so that the points show up well within the borders of > > > > > > > the map > > > > > > > each time. > > > > > > > > > In CSS this would be like "padding": I want to have a 10pixel > > > > > > > width > > > > > > > buffer in which no points are shown so that all points will be > > > > > > > nicely > > > > > > > situated within the visible points of the map. > > > > > > > > > As is, it's a very functional map so I'm just nit-picking, but > > > > > > > it's > > > > > > > definitely a pretty big cosmetic flaw if the markers aren't easily > > > > > > > seen in certain cases. > > > > > > > > > For example, go towww.onsenjapan.netandfindonsenthatare 50 miles > > > > > > > from Tokyo. > > > > > > > > > As always, thank you very much for assistance and suggestions. > > > > > > > There > > > > > > > are some hugely helpful people here. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" 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-API?hl=en -~----------~----~----~----~------~----~------~--~---
