google maps - How to calculate center of bounds without GoogleMaps? -


i have following bounds:

var bounds = {     southeast: {lat: 54.69726685890506, lng: -2.7379201682812226},     northeast: {lat: 55.38942944437183, lng: -1.2456105979687226} }; 

by using google maps api calculate canter of bounds above following:

// returns (55.04334815163844, -1.9917653831249726) (new google.maps.latlngbounds(bounds.southeast, bounds.northeast)).getcenter(); 

how calculate center of bounds without using google.maps.latlngbounds.getcenter math?

edit: need write "magic" function returns same center lat, lng google.maps.latlngbounds.getcenter:

function getboundscenter(bounds) {     // need calculate , return center of passed bounds;     }  var center = getboundscenter(bounds); // center should (55.04334815163844, -1.9917653831249726)  

var bounds = {     southwest: {lat: 54.69726685890506, lng: -2.7379201682812226},     northeast: {lat: 55.38942944437183, lng: -1.2456105979687226} };  center lat = (southwest.lat + northeast.lat)/2 = 55.043348151638 center lng = (southwest.lng + northeast.lng)/2 = -1.991765383125 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -