使用 Mapbox 查找左下角和右上角(纬度、经度)- [Android]
Find the bottom left + upper right corners (latitude, longitude) with Mapbox - [Android]
在Android中使用MapBox,我试图找到左下角和右上角。我无法在他们的文档中找到任何地方来检索此信息。
这行代码应该完成您想要做的事情:
LatLngBounds bounds = mapboxMap.getProjection().getVisibleRegion().latLngBounds;
编辑
抱歉,这是 4.0 中即将推出的功能。现在您可以使用它作为解决方法:
int viewportWidth = mMapView.getWidth();
int viewportHeight = mMapView.getHeight();
LatLng topLeft = mMapView.fromScreenLocation(new PointF(0, 0));
LatLng topRight = mMapView.fromScreenLocation(new PointF(viewportWidth, 0));
LatLng bottomRight = mMapView.fromScreenLocation(new PointF(viewportWidth, viewportHeight));
LatLng bottomLeft = mMapView.fromScreenLocation(new PointF(0, viewportHeight));
希望对您有所帮助!
在Android中使用MapBox,我试图找到左下角和右上角。我无法在他们的文档中找到任何地方来检索此信息。
这行代码应该完成您想要做的事情:
LatLngBounds bounds = mapboxMap.getProjection().getVisibleRegion().latLngBounds;
编辑
抱歉,这是 4.0 中即将推出的功能。现在您可以使用它作为解决方法:
int viewportWidth = mMapView.getWidth();
int viewportHeight = mMapView.getHeight();
LatLng topLeft = mMapView.fromScreenLocation(new PointF(0, 0));
LatLng topRight = mMapView.fromScreenLocation(new PointF(viewportWidth, 0));
LatLng bottomRight = mMapView.fromScreenLocation(new PointF(viewportWidth, viewportHeight));
LatLng bottomLeft = mMapView.fromScreenLocation(new PointF(0, viewportHeight));
希望对您有所帮助!