Calculating straight-line distance between cities

  • Context: Undergrad 
  • Thread starter Thread starter Nathanael
  • Start date Start date
Click For Summary
SUMMARY

The discussion focuses on calculating the straight-line distance between two cities using their longitude and latitude coordinates. The initial formula presented, ##B=\sqrt{B_1^2+B_2^2}##, is deemed insufficient as it does not account for the spherical nature of the Earth. The correct approach involves using spherical coordinates to derive the angle ##\angle C_1OC_2##, leading to the formula for straight-line distance through space: $$d=\sqrt{(z_2-z_1)^2+(y_2-y_1)^2+(x_2-x_1)^2}$$. This method incorporates the Earth's radius and the coordinates of the cities accurately.

PREREQUISITES
  • Understanding of spherical coordinates
  • Knowledge of trigonometric functions and their applications
  • Familiarity with the Earth's radius and its significance in distance calculations
  • Basic proficiency in 3D geometry
NEXT STEPS
  • Research the derivation of the great circle distance formula
  • Learn about spherical trigonometry and its applications in navigation
  • Explore the conversion of spherical coordinates to Cartesian coordinates
  • Investigate the implications of Earth's curvature on distance calculations
USEFUL FOR

This discussion is beneficial for mathematicians, geographers, astronomers, and anyone involved in navigation or geographic information systems (GIS) who requires accurate distance calculations between geographical coordinates.

Nathanael
Homework Helper
Messages
1,650
Reaction score
246
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=\sqrt{B_1^2+B_2^2}##
##B_1=2R\sin(\theta / 2)##
##B_2=2R\sin(\phi / 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.
 
Physics news on Phys.org
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.
 
Are you looking for the "straight-line" distance 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 ##\theta## value corresponds to different distances according to how far from the poles you are. You're not taking that effect into account.
 
  • Like
Likes   Reactions: sophiecentaur
I doubt it would be that, because the formula is symmetric in ##\theta## and ##\phi## but their roles in the spherical coordinates are not symmetric. If ##\theta## is the azimuth then it relates to a smaller circle (non-great circle) than ##\phi##.

I think the correct formula will be based on doing the 3D geometry to work out the angle ##\angle C_1OC_2## where ##C_1,C_2## are the locations of the two cities on the sphere and ##O## is the centre. Then the distance is just ##R \angle C_1OC_2##.

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 ##\mathbb{R}^3##, for which a different formula would apply, but again I would not expect it to be symmetric in ##\theta,\phi##.
 
Ok, thanks everyone. Yes I meant the straight-line distance through space, not the curved path along the surface.

Let us use ##Φ_1## ##θ_1## and ##Φ_2## ##θ_2## for each city. (Φ is latitude so Φ=0 is on the equator.)

If Φ_1 = Φ_2, it would be:
##B=2R\cos(Φ)\sin\big(\frac{\left |θ_2-θ_1\right |}{2}\big)##

If θ_1 = θ_2 it would be:
##B=2R\sin\big(\frac{\left |Φ_2-Φ_1\right |}{2}\big)##

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.
 
The coordinates of ##C_i## are ##z_i=R\cos\phi_i,\ x_i=R\sin\phi_i\cos\theta_i,\ y_i=R\sin\phi_i\sin\theta_i##.
The straight line distance will be

$$d=\sqrt{(z_2-z_1)^2+(y_2-y_1)^2+(x_2-x_1)^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}\frac{d}{2R}$$
 
Last edited:
  • Like
Likes   Reactions: sophiecentaur
Good point, converting to cartesian then using pythaogrean is a straightforward solution, thanks Andrew.
 

Similar threads

  • · Replies 18 ·
Replies
18
Views
4K
Replies
13
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 62 ·
3
Replies
62
Views
4K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 16 ·
Replies
16
Views
7K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 22 ·
Replies
22
Views
3K
  • · Replies 24 ·
Replies
24
Views
8K