Gmaps4rails V2 - change default zoom
remove:
handler.fitMapToBounds();
Replace with:
handler.getMap().setZoom(yourValue);
Just Try This,<script type="text/javascript"> handler = Gmaps.build('Google'); handler.buildMap({ provider: { Zoom: 3 }, internal: {id: 'map'}}, function(){ markers = handler.addMarkers(<%=raw @hash.to_json %>); handler.bounds.extendWith(markers); handler.fitMapToBounds(); }); </script>
OR
handler.getMap().setZoom(yourValue);
It Should work.....
Another option is to use handler.map.centerOn(marker):
handler = Gmaps.build('Google'); handler.buildMap({ provider: { draggable: false, Zoom: 15 }, internal: { id: 'map' } }, function(){ marker = handler.addMarker( { "lat": lat, "lng": lng, "picture": { "url": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/13/13028-64.png", "width": 36, "height": 36 }, "infowindow": "hello!" } ); handler.map.centerOn(marker); } );