gpt4 book ai didi

android - 从相机位置获取 LatLngBounds

转载 作者:太空宇宙 更新时间:2023-11-03 13:16:57 25 4
gpt4 key购买 nike

我想获取 Google map 框架右上角和左下角的 LatLng 以创建 LatLngBounds。有可能吗?

map

最佳答案

这可以使用 Map View API 轻松确定:

yourMapFragment.getMap().getProjection().getVisibleRegion().latLngBounds

哪个docs状态是:

The smallest bounding box that includes the visible region defined in this class.

或者,您也可以通过替换 latLngBounds 来获取投影的各个角与 farLeft , farRight , nearLeftnearRight

在你的情况下,你可以简单地使用

LatLng bottomLeft = 
yourMapFragment.getMap().getProjection().getVisibleRegion().nearLeft;

LatLng topRight =
yourMapFragment.getMap().getProjection().getVisibleRegion().farRight;

关于android - 从相机位置获取 LatLngBounds,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34578418/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com