How do you get the best zoom level from a Bounds object (api v3)?
-
v2 of the api let you get the best zoom for a Bounds instance. Now there is no api method for it. Instead there is Map.fitBounds which in my case always zooms from the previous bounds. My specific use case is essentially map.fitBounds(map.getBounds()) across two different page hits. The map dimensions remain the same. From my research, I think Map.fitBounds is taking into account a maps controls which cover the map
-
Answer:
Pretty sure you don't want to call map.fitBounds(map.getBounds()). Instead you want to pass the bounds object to map.fitBounds() like so.... var bounds = new google.maps.LatLngBounds(); bounds.extend(new google.maps.LatLng(43.09206500, -89.35494200)); bounds.extend(new google.maps.LatLng(43.09300500, -89.35794100)); var map = new google.maps.Map($('#Map').get(0), { zoom: 14, center: bounds.getCenter(), mapTypeId: google.maps.MapTypeId.ROADMAP }); map.fitBounds(bounds);
Brent Theisen at Quora Visit the source
Related Q & A:
- How do I get My Yahoo! page off as a default?Best solution by Yahoo! Answers
- How do I get people to sign up for a referral partner program for our company?Best solution by Yahoo! Answers
- How do u get to all the folders on a hard drive?Best solution by Yahoo! Answers
- How do I get my Best Buy credit card number?Best solution by bestbuy.com
- How can I get the best quality video out of my mini DV camcorder?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.