开发者

Map view set according to distance

I am a new android developer. I am creating a map view application Where I want to set up my map view according distance from my current location. I have three butt开发者_运维技巧ons such as 100m,500m and 1 Km . When application is started then mapview will appear and current location is the center of the map. When i tap on 1 km then the map view is set up 1 km according to current location. How can i do this.Thanks in advance.


You have to compute 1km in latitude and longitude, set the center to your current position ( I guess you succed to do that) and set the span to your MapController:

mController.zoomToSpan((int) spanLat,(int) spanLon);

zoomToSpan public void zoomToSpan(int latSpanE6,int lonSpanE6)

Attempts to adjust the zoom of the map so that the given span of latitude and longitude will be displayed. Because the zoom can only achieve discrete levels, and because the aspect ratio of the map may not match the ratio given, the quality of the fit may vary. The only thing we guarantee is that, after the zoom, at least one of the new latitude or the new longitude will be within a factor of 2 from the corresponding parameter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜