Topic: Zoom the map to the bounds of an object

I'd like to be able to zoom the map so that it fit an object.
To do that my idea is to:
1 - get the max and min bounds of the object and convert that in long/lat positions
2 - get the bounds (corners) of the map as long/lat positions
3 - get the difference
4 - calculate the new zoom level to fit the object

My problems are:
2 - I can't remember how to get the corners of the map... hmm
4 - Which is the difference in long/lat from each zoom level? Is it 2x / 0.5x ?

P.s. maybe there's a better way?
Many thanks!

Re: Zoom the map to the bounds of an object


2. OnlineMaps.GetCorners. … d91edd9f1c

4. The differences in lng / lat are different.
Sorry for the tautology.
The map is counted in tiles from the coordinate of the center point.
Tiles at the same zoom level may contain a different number of degrees of latitude and longitude.
The difference in tile positions is x2 and x0.5.

P.S. Most likely you are looking for OnlineMapsUtils.GetCenterPointAndZoom. … cc18081dc8

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Zoom the map to the bounds of an object

Many thanks! It seem to be just what I need.
It's incredible how many functions are implemented in OnLineMaps