基于球面的常用地圖計算分享
在地圖的開發(fā)中,涉及到經緯度計算,本身顯示坐標是度數(shù)的單位,這在計算距離、角度等地理信息時,會有一定的不同,特別是在球面的計算時,要考慮地球的半徑等信息,本文分享一個開源的球面常用地圖計算公式網站。
http://www.movable-type.co.uk/scripts/latlong.htmlThis page presents a variety of calculations for lati-tude/longi-tude points, with the formulas and code fragments for implementing them.國外英文的介紹網站,請耐心觀看,每個計算中,都有對應的JavaScript示例代碼。
Distance,使用haversine(半正矢公式)公式,計算兩個經緯度點之間的距離,計算結果為米制單位,公式和計算代碼參見網站;
Spherical Law of Cosines,余弦球面定理;
Bearing,計算正北的偏轉角度;
Midpoint,計算兩個點之間的中心點;
Destination point given distance and bearing from start point,根據(jù)起點坐標、偏北角度、距離,計算目的點坐標;Intersection of two paths given start points and bearings,根據(jù)兩個起點、對應角度,計算兩個起點延長線的交點;
Rhumb lines,恒向線計算;
? ? ??...
其他的計算請參見網址查看。
http://www.movable-type.co.uk/scripts/latlong.html?
標簽: