Calculating straight-line distance between cities |
Üdvözöllek a Fórumban! ( Bejelentkezés | Regisztráció )
![]() ![]() |
Calculating straight-line distance between cities |
![]()
Létrehozva:
#1
|
|
Advanced Member ![]() ![]() ![]() Csoport: Members Hozzászólások: 480 Csatlakozott: 8-September 18 Azonosító: 761 ![]() |
Suppose we know the (longitude/latitude) coordinates of two cities and we want to find the straight-line distance between them. Call this distance B. Would this be correct? B = √ B 2 1 + B 2 2 B=B12+B22 B 1 = 2 R sin ( θ / 2 ) B1=2Rsin(θ/2) B 2 = 2 R sin ( ϕ / 2 ) B2=2Rsin(ϕ/2) Where: R is the Earth's radius θ and Φ are the difference between the longitude/latitude coordinates respectively. Seems correct to me, but I have an astronomy lab where the coordinates of two cities are given and the (straight-line) distance between them is given, but it doesn't agree with my formula above.
|
|
|
Guest_edwfwfwf_* |
![]()
Létrehozva:
#2
|
Guests ![]() |
Off the top of my head, I should have expected the latitude to be included in the calculation for the distance between lines of longitude. Your formula seems to assume that the distance between lines of longitude is the same from equator to pole. (no spherical effects) I did all this once in a Nav course and once in a propagation programme for HF broadcasting but it's all gone!!! At first, I thought "great circle" but, of course, for Astronomy, you really do want the straight line distance.
|
|
|
Guest_EFVDAFVDAVDAV_* |
![]()
Létrehozva:
#3
|
Guests ![]() |
I doubt it would be that, because the formula is symmetric in θ θ and ϕ ϕ but their roles in the spherical coordinates are not symmetric. If θ θ is the azimuth then it relates to a smaller circle (non-great circle) than ϕ ϕ. I think the correct formula will be based on doing the 3D geometry to work out the angle ∠ C 1 O C 2 ∠C1OC2 where C 1 , C 2 C1,C2 are the locations of the two cities on the sphere and O O is the centre. Then the distance is just R ∠ C 1 O C 2 R∠C1OC2. Edit: I just saw Nugatory's post. I had assumed by 'straight line' you meant the great circle distance, but as he points out, you may mean the straight line in R 3 R3, for which a different formula would apply, but again I would not expect it to be symmetric in θ , ϕ θ,ϕ.
|
|
|
Guest_FCGVHBJNKN_* |
![]()
Létrehozva:
#4
|
Guests ![]() |
Ok, thanks everyone. Yes I meant the straight-line distance through space, not the curved path along the surface. Let us use Φ 1 Φ1 θ 1 θ1 and Φ 2 Φ2 θ 2 θ2 for each city. (Φ is latitude so Φ=0 is on the equator.) If Φ_1 = Φ_2, it would be: B = 2 R cos ( Φ ) sin ( | θ 2 − θ 1 | 2 ) B=2Rcos(Φ)sin(|θ2−θ1|2) If θ_1 = θ_2 it would be: B = 2 R sin ( | Φ 2 − Φ 1 | 2 ) B=2Rsin(|Φ2−Φ1|2) I'll have to think more about how to put it together when both coordinates are different. I can't use pythagoreans theorem as I don't believe they would be perpendicular (unless φ=0 for one of the cities). Thanks again, I'll think about it.
|
|
|
Guest_WEFWFEWFWF_* |
![]()
Létrehozva:
#5
|
Guests ![]() |
The coordinates of C i Ci are z i = R cos ϕ i , x i = R sin ϕ i cos θ i , y i = R sin ϕ i sin θ i zi=Rcosϕi, xi=Rsinϕicosθi, yi=Rsinϕisinθi. The straight line distance will be d = √ ( z 2 − z 1 ) 2 + ( y 2 − y 1 ) 2 + ( x 2 − x 1 ) 2 d=(z2−z1)2+(y2−y1)2+(x2−x1)2 Substituting the formulas from the first line into that gives the answer. I imagine some simplification is possible. Further, although this isn't what you're after, the great circle distance will be R sin − 1 d 2 R Rsin−1d2R
Reference https://www.physicsforums.com/threads/calcu...-cities.830092/ |
|
|
![]()
Létrehozva:
#6
|
|
Advanced Member ![]() ![]() ![]() Csoport: Members Hozzászólások: 480 Csatlakozott: 8-September 18 Azonosító: 761 ![]() |
Are you looking for the "straight-line" Distance calculator across the curved surface of the earth (the distance you'd cover if you walked from one city straight towards the other) or the straight-line path that goes through the earth? Either way, the same θ θ value corresponds to different distances according to how far from the poles you are. You're not taking that effect into account.
|
|
|
Guest_FCGVHBJNKN_* |
![]()
Létrehozva:
#7
|
Guests ![]() |
Good point, converting to cartesian then using pythaogrean is a straightforward solution, thanks Andrew.
|
|
|
![]() ![]() ![]() |
Szöveges verzió | A pontos idő: 3rd September 2024 - 11:44 AM |