วิธีการคำนวณ Haversine
learn.whatIsHeading
The Haversine formula calculates the great-circle distance between two points on a sphere (like Earth) from their latitude and longitude. It is used in navigation, mapping, and GPS applications.
สูตร
a = sin²(Δφ/2) + cos(φ₁)cos(φ₂)sin²(Δλ/2); d = 2R·arcsin(√a)
- φ₁, φ₂
- latitude of points 1 and 2 (radians)
- Δφ
- difference in latitude (radians)
- λ₁, λ₂
- longitude of points 1 and 2 (radians)
- Δλ
- difference in longitude (radians)
- R
- Earth radius (km (≈6371)) — or miles (≈3959)
- d
- great-circle distance (km or miles)
คำแนะนำทีละขั้นตอน
- 1a = sin²(Δlat/2) + cos(lat₁)cos(lat₂)sin²(Δlon/2)
- 2c = 2×atan2(√a, √(1−a))
- 3d = R × c, where R = 6371 km (Earth radius)
- 4Gives shortest path along Earth's surface
ตัวอย่างที่มีคำตอบ
อินพุต
London (51.5°N,0.1°W) to New York (40.7°N,74°W)
ผลลัพธ์
≈ 5,570 km / 3,461 miles
อินพุต
Paris to Berlin
ผลลัพธ์
≈ 878 km
คำถามที่พบบ่อย
What is a great circle?
The shortest path between two points on a sphere. On Earth, that's the shortest route between two locations.
Why not use Euclidean distance for GPS?
Earth is curved (sphere). Euclidean distance (straight line) ignores the curvature and gives incorrect results.
Is haversine the only way to calculate geographic distance?
No, but it's accurate, numerically stable, and avoids singularity issues of other formulas.
พร้อมที่จะคำนวณแล้วหรือยัง? ลองใช้เครื่องคิดเลข Haversine ฟรี
ลองด้วยตัวคุณเอง→