/**
* 測算點的距離
*/
public void cldistance(){
double lon1= (Math.PI/180)*lons;
double lon2= (Math.PI/180)*lonss;
double lat1= (Math.PI/180)*lats;
double lat2= (Math.PI/180)*latss;
//地球半徑
double R = 6371;
//*1000是要得到兩點相距多少米
double d = Math.acos(Math.sin(lat1)*Math.sin(lat2)+Math.cos(lat1)*Math.cos(lat2)*Math.cos(lon2-lon1))*R;
d = d * 1000;
System.out.println(d);
}
測算經緯度兩點之間的距離
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.