Android的谷歌地图获得边界坐标 [英] Android Google Maps get Boundary Co-ordinates

查看:263
本文介绍了Android的谷歌地图获得边界坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的谷歌地图V2在我的应用程序。当用户平移或缩放屏幕上我想获得地图的基础上,我想获取的POI,只有在屏幕视图的一部分的区域。
我经历了文档,但找不到任何帮助。

I am using Google Maps v2 in my application. When the user pans or zooms on the screen I would like to get the area of the map based on which I want to fetch the POI only in the screen view part.
I went through the documentation but could not find any help.

推荐答案

您需要使用<一个href="https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/Projection"><$c$c>Projection和<一href="https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/VisibleRegion"><$c$c>VisibleRegion类,以获得可见经纬度区。
所以,你的code看起来是这样的:

You need to use Projection and VisibleRegion classes in order to get visible LatLng region.
So your code would look something like:

LatLngBounds curScreen = googleMap.getProjection()
    .getVisibleRegion().latLngBounds;

这篇关于Android的谷歌地图获得边界坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆