Friends, I have another question: how to implement automatic scaling of Google maps?
Situation: There is the current location of the user, which we show on the map. After that, we create two or three labels at some distance from the user. The task: to automatically mass scale the map so that it would show both the user’s location and all the placemarks on the map.
Now I easily display the user’s current location on the map (thanks to the creators of Thunkable), and all the necessary labels - but if the label goes beyond the visible field of the map - until the user zooms out on his own - the label is not visible.
How can this be done?
to change the view.
This option, yes, I know - but it is not very good, because if the labels are far from each other, I may not guess with the scaling and make it too large or too small …
I think there’s 4 questions to answer here
How far apart are my two furthest POI
How do figure ^^^^ this out?
How many km wide is the map at each zoom level
Based on the above, what zoom level would encompass all my POi
If you can answer these, you can achieve this “auto scaling” behavior.
By the way, this is a very interesting option! Thanks! I will conduct experiments
MAP object in Google has a method called
This can be done in a
fitbounds() method allows passing only two coordinates which are the two furthest point, the documentation names them as NE and SW to display the complete markers without having to add all of them to the list.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.