/ Published in: JavaScript
                    
                                        
Center the map on an array of latlng values
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
var latlngbounds = new google.maps.LatLngBounds();
for ( var i=0; i<route.length; i++ ){
latlngbounds.extend(route[i]);
}
map.setCenter( latlngbounds.getCenter(), map.fitBounds(latlngbounds));
Comments
 Subscribe to comments
                    Subscribe to comments
                
                