我正在尝试计算从屏幕/地图中间(显示)到屏幕顶部的距离。我有一些算法可以做到这一点,但我不确定它是否正常工作。我得到像6367及以上的数字。这是我的算法:
double Radius = 6367.45;
LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds;
LatLng center = bounds.getCenter();
LatLng north = bounds.northeast;
// Convert lat or lng from decimal degrees into radians (divide by 57.2958)
double centerLat = center.latitude / 57.2958;
double centerLong = center.longitude / 57.2958;
double northLat = north.latitude / 57.2958;
double northLong = north.longitude / 57.2958;
// distance = circle radius from center to top of the screen
// this I ma not sure if it returns true numbers like amm real distance
// and I call it in the setOnCameraChangeListener on every zoom right?
// yes
boundRadius = Radius*(Math.acos(Math.sin(centerLat) * Math.sin(northLat) + Math.cos(centerLat)*Math.cos(northLat)*Math.cos(northLong - centerLong)));
我是否正确计算?如果没有,我做错了什么?
答案 0 :(得分:1)