我想要做的是计算用户查看地图的圆的半径 到目前为止,我已经写了解决方案(这是真的):
mMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
@Override
public void onCameraChange(CameraPosition cameraPosition) {
String TAG = AppController.TAG;
LatLngBounds bounds = mMap.getProjection().getVisibleRegion().latLngBounds;
LatLng target = cameraPosition.target;
LatLng northEast = bounds.northeast;
LatLng southEast = bounds.southwest;
float[] results1 = new float[1];
float[] results2 = new float[1];
Location.distanceBetween(target.latitude, target.longitude, northEast.latitude, northEast.longitude, results1);
Location.distanceBetween(target.latitude, target.longitude, southEast.latitude, southEast.longitude, results2);
double distance = results1[0] > results2[0] ? results1[0] : results2[0];
Log.d(TAG, "onCameraChange:" + results1[0] + " " + results2[0]);
}
});
我在这里面临两个问题:
1-首先,为什么中心和东北之间的偏差不等于西南?
2-是否有任何内置方法可以达到相同的效果?