fitbounds

Google Maps API v3: Can I setZoom after fitBounds?

I have a set of points I want to plot on an embedded Google Map (API v3). I'd like the bounds to accommodate all points unless the zoom level is too low (i.e., zoomed out too much). My approach has been like this: var bounds = new google.maps.LatLngBounds(); // extend bounds with each point gmap.fitBounds(bounds); gmap.setZoom( Mat...

setbounds on google maps api v3

I'm trying to set the bounds of a map fitbounds doesnt work because it puts some space around the bounds therefore doing {{{map.fitBounds(map.getBounds())}}} a few times will quickly zoom the map out I need to be able to do {{{map.setBounds(map.getBounds())}}} and for nothing to happen please note I am using v3 of the api and t...

fitbounds() in Google maps api V3 does not fit bounds

I'm using the geocoder from Google API v3 to display a map of a country. I get the recommended viewport for the country but when I want to fit the map to this viewport, it does not work (see the bounds before and after calling the fitBounds function in the code below). What am I doing wrong? How can I set the viewport of my map to resu...

Google Maps v3: Enforcing min. zoom level when using fitBounds

I'm drawing a series of markers on a map (using v3 of the maps api). In v2, I had the following code: bounds = new GLatLngBounds(); ... loop thru and put markers on map ... bounds.extend(point); ... end looping map.setCenter(bounds.getCenter()); var level = map.getBoundsZoomLevel(bounds); if ( level == 1 ) level = ...

Google Maps v3 - Automating Zoom Level?

I'm having the possibility to have multiple markers. Currently i'm using the map.fitBounds(bounds); In my css to have the map resized (bounds contains multiple latlng's). What am i doing wrong? Because it won't use the best zoom level :-( Edit: Javascript source var geocoder, map; $(document).ready(function(){ ...

Google Maps API V3 fitbounds() zooms out but never in

I've created a quite complex store locator of sorts. The user enters their zip and a table returns results with corresponding markers on a map. They can page through results and the markers move further and further out and the fitbounds() function works great for zoom out to the appropriate zoom level to fit the markers. The problem is t...

Google Maps v3 fitBounds() Zoom too close for single marker

Hey everyone. Is there a way to set a max zoom level for fitBounds()? My problem is that when the map is only fed one location, it zooms in as far as it can go, which really takes the map out of context and renders it useless. Perhaps I am taking the wrong approach? Thanks in advance! ...

Google Maps fitBounds is not working properly.

I have a problem with googlemaps fitBounds functions. for (var i = 0; i < countries.length; i++) { var country = countries[i]; var latlng = new google.maps.LatLng(parseFloat(country.lat), parseFloat(country.lng)); mapBounds.extend(latlng); } map.fitBounds(mapBounds); Some icons will be displayed outside the viewport / Visible are...

Google Maps fitBounds object from left, right and bottom fit in bounds but from top don't

Here is my code. function CICOverlay(json) { /* * @param is a json object containing the search parameters * - IDReiseart * - Hotelart * - IDLand * - Region */ this.param = json.param; /* * @zielgebiet is an Array containing name and geoda...

Google Maps map.getBounds() immediately after a call to map.fitBounds

I'm calling getBounds() directly after a call to fitBounds(), and I thought I'd get a valid bound back as the map recenters and zooms to fit the bounds. Unfortunately, getBounds() is returning nil. The code to reproduce this is as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-...

Calling map.fitBounds() Multiple Times in Google Maps API v3.0

I've just begun using the Google Maps API (v3.0) and have had a good deal of success so far. I am loading a set of objects with Latitude & Longitude values from a database, passing them into my script, and looping over them in the script in order to add them to the map. I am using the "bounds.extend() / map.fitBounds()" method of settin...