【问题标题】:Get Map Bounds Using Android Google Maps [duplicate]使用 Android Google Maps 获取地图边界 [重复]
【发布时间】:2010-07-31 02:05:22
【问题描述】:

可能重复:
How can I determine if a geopoint is displayed in currently viewable area?

我想知道是否有任何方法(我是 Java 新手)在 Android 上获取 Google MapView 的 MapBounds。

澄清一下,这就是我想做的事情。

在地图移动或缩放时计算最大和最小经纬度,并在 Toast 中显示这些值。

有没有可能的方法来做到这一点 - 或者我是不是在我的头上?

【问题讨论】:

    标签: android google-maps


    【解决方案1】:

    你应该可以使用

    mapView.getLatitudeSpan();
    mapView.getLongitudeSpan();
    

    结合

    mapView.getMapCenter();
    

    找出可见区域。

    但我注意到一些用户对此有疑问。

    Mapview getLatitudeSpan and getLongitudeSpan not working

    也许你也应该检查一下 android 开发者组。

    【讨论】:

    • 谢谢,通过这两个命令以及我从 locationManager 服务中得到的信息,一切运行良好。
    • 这个答案给出了我在阅读你的答案后遗漏的线索:stackoverflow.com/questions/3413194/…
    • mapView.getMapCenter() 而不是 getCenter()
    • @RomainPiel 对于较新的 SDK,您是对的,在撰写本文时,getCenter() 是通过 afaik(SDK 8)唯一的方法。感谢您的信息。
    • 如果你想要完整的代码在这里:stackoverflow.com/a/13674810/450148
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-11
    • 2013-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-24
    • 2015-08-08
    相关资源
    最近更新 更多