我想找到Latitude,例如
Point A = (18.5204303,73.8567437)
Point B = (x,73.8567437)
Distance =20KM(Kilometers)
我需要找到B点的纬度(x),距离A点20公里.长度应该相同.帮我
提前致谢
解决方法:
我找到了我的问题的答案
var lat1 = 18.5204303;
var lon1 = 73.8567437;
var d = 20; //Distance travelled
var R = 6371;
var brng = 0;
var LatMax;
brng = toRad(brng);
var lat1 = toRad(lat1), lon1 = toRad(lon1);
var lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) +
Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng) );
var lon2 = lon1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(lat1),
Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));
lon2 = (lon2+3*Math.PI) % (2*Math.PI) - Math.PI;
lat2= toDeg(lat2);
lon2= toDeg(lon2);
alert(lat2);
alert(lon2);
function toRad(Value) {
/** Converts numeric degrees to radians */
return Value * Math.PI / 180;
}
function toDeg(Value) {
return Value * 180 / Math.PI;
}
谢谢你们