埃德威廉斯的航空公式http://williams.best.vwh.net/avform.htm是一個很好的,方便的地方開始。我經常參考http://movable-type.co.uk/scripts/latlong.html。
我猜你需要某種向量(你的問題有點不清楚)。
我使用什麼(在C,而不是Java)來計算出修正徑向距離是:
void polarToLatLong(double lat, double lon, double dist, double radial,
double *outlat, double *outlon) {
if (!dist) { // distance zero, so just return the point
*outlat = lat;
*outlon = lon;
}
else if (lat > 89.9999) { // North Pole singularity. Dist is in NM.
*outlat = 90 - dist/60;
*outlon = fmod(radial + 180) - 180;
}
else { // normal case
double sinlat, coslon;
dist /= 3442; // = Earth's radius in nm (not WGS84!)
sinlat = Sin(lat) * cos(dist) + Cos(lat) * sin(dist) * Cos(radial);
*outlat = Arcsin(sinlat);
coslon = (cos(dist) - Sin(lat) * sinlat)/(Cos(lat) * Cos(*outlat));
*outlon = lon + (Sin(radial) >= 0 : -1 : 1) * Arccos(coslon);
}
}
在上面的代碼Sin()
,用一個大寫S,只是一個sin()
包裝爲度:
#define CLAMP(a,x,b) MIN(MAX(a, x), b) // GTK+ GLib version slightly different
double Sin(double deg) {return sin(deg * (PI/180));} // wrappers for degrees
double Cos(double deg) {return cos(deg * (PI/180));}
double Arcsin(double x) {return asin(CLAMP(-1, x, 1)) * (180/PI);}
double Arccos(double x) {return acos(CLAMP(-1, x, 1)) * (180/PI);}
看到這個[答案](http://stackoverflow.com/questions/1253499/simple-calculations-for-working-with-lat-lon-km-distance/1253545#1253545) – TheWhiteRabbit
「小數距離」是什麼意思? –
我不說「小數點距離」,而是「小數點」。這就是我的意思:http://en.wikipedia.org/wiki/Decimal_degrees – WillyRobert