开发者

Google Maps Android zoom to country

开发者 https://www.devze.com 2023-03-10 22:31 出处:网络
I need the following implementation in Android:How to get Google Maps API to set the correct zoom level for a country?

I need the following implementation in Android:

How to get Google Maps API to set the correct zoom level for a country?

For those that do'nt want to click:

How to zoom to a country by name in an Android application?

Anyone got a pointer on how to accomplish this task?

Edit: i guess i can parse this file.

But 开发者_StackOverflowthen the question is: map.fitBounds() kind of method in Android?

Thanks in advance


Ok ill answer my own question. I parsed the file above and used the following code to zoom to the countries:

MapController controller = mapView.getController();
controller.zoomToSpan(
        (maxLat - minLat),
        (maxLong - minLong));

controller.animateTo(new GeoPoint(
            (maxLat + minLat)/2,                 
            (maxLong + minLong)/2 ));
0

精彩评论

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