我有一个MapView,我正在显示一个"有用的半径"(想想坐标的准确性).使用MapView's Projection的meterToEquatorPixels,这当然只是赤道距离)并没有给我足够准确的距离(以像素为单位) ).如果你想在给定半径的坐标周围显示一个圆圈,你会如何计算?
我仍然在计算第二点提供的lat/lng和第一点和距离的lat/lng时遇到问题.
我在Javascript中找到了一个解决方案,我试图转换为Java.但结果不准确,似乎我做错了什么.
public class Misc {
double EARTH_RADIUS_METERS= 6378.1 *1024;
private double toRad(double value) {
return value* (Math.PI/ 180);
}
private double toDeg (double value) {
return value* (180 / Math.PI);
}
/*-------------------------------------------------------------------------
* Given a starting lat/lon point on earth, distance (in meters)
* and bearing, calculates destination coordinates lat2/lon2.
*
* all params in radians
*-------------------------------------------------------------------------*/
GPoint destCoordsInRadians(double lat1, double lon1,
double distanceMeters, double bearing
/*,double* lat2, double* lon2*/)
{
//-------------------------------------------------------------------------
// Algorithm from http://www.geomidpoint.com/destination/calculation.html
// Algorithm …Run Code Online (Sandbox Code Playgroud)