I have an array with 10 different latitude and longitude numbers gathered from GMaps. I want to show all of them on the same map in the same time. What I need to achieve, is calculate the best latitude and longitude values and zoom level (or have a formula that would calculate them for a certain zoom level), so that all markers are visible.
I am able to implement a math formula into a language of my choice, but any suggestions are welcome.
Thanks!
The trick is to add them all to a LatLngBounds object and then use the .getCenter() function, with JavaScript. Here’s a psuedo-code example for V2: