E
E
Eugene2017-06-13 08:28:49
Google
Eugene, 2017-06-13 08:28:49

"Smart" zoom in Google Map JS API?

Hello!
I've been struggling with this problem for some time and can't find a solution.
The bottom line is this: the screen is divided into two parts. On the right we show a list of addresses added by the user. On the left we show a map with labels for these addresses.
The task is to show all labels. And based on the last 10 places, center the map and zoom in so that all of them are visible. Addresses can be all over the world.
I put the marks on the map. But I have no idea how to adjust the zoom based on the last 10.
Many thanks in advance for your help!
Sincerely, Evgeny.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2017-06-13
@nimfai

I won’t speak for the whole of Odessa GoogleAPI, but the mechanism should be like this: There is a bounds class, you drive all your 10 markers into it and as a result you get a coverage square, into which all these markers fall. Next, the map should have a method to show this same bounds, it will calculate the center and the necessary zoom by itself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question