Topic: Zoom the map to the bounds of an object
Hello,
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...
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!