我正在为我的新谷歌地图应用程序使用谷歌地图 API v2。我想知道如何计算当前屏幕位置的 4 个边缘的坐标,以便我可以搜索直接位于相机 View 中的标记。关于如何实现的任何想法?我想到了相机 View 中心和缩放的一些东西,但不知道如何继续。
最佳答案
以下是获取右上角和左下角坐标的正确答案:
mMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
@Override
public void onCameraChange(CameraPosition position) {
LatLngBounds bounds = mMap.getProjection().getVisibleRegion().latLngBounds;
//fetchData(bounds);
ne = bounds.northeast;
sw = bounds.southwest;
//new DownloadJSON().execute();
//Log.e("LatLngs"," southwest: "+sw+" northeast: "+ne);
}
});
关于android - 计算谷歌地图v2中4条边的坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28991857/