Ashish Nair
Ashish Nair

Reputation: 85

How to set Zoom Level in android Map v2 on the basis of Kilometers selected by User?

Upvotes: 4

Views: 800

Answers (1)

Pavel Dudka
Pavel Dudka

Reputation: 20934

Try to use this formula:

zoomLevel = 19 - Math.log(altitudeKm * 5.508);

It is not going to be 100% accurate since map is 2D representation of 3D world. Thus there is no such thing as 'view altitude'. Anyways I tried to play a bit with it and it looks close enough. :)

Taken from here. Bing maps use the same Mercator projection as android map v2, so basic math should be the same

Upvotes: 2

Related Questions