[Math] Calculate average latitude / longitude

averagecoordinate systemsgeodesy

I have the array of geographical coordinates (latitude & longitude).

What is the best way to calculate average latitude and longitude?

Thanks!

Best Answer

This is a question of directional statistics. Similar issues arise with the average of circular quantities.

The conventional method is to convert latitudes ($\phi_i$) and longitudes ($\lambda_i$) into three dimensional points $(x_i,y_i,z_i)$ using

$$(R \cos \phi_i \cos \lambda_i, R \sin \phi_i \cos \lambda_i , R \sin \lambda_i )$$

then take the mean of these points $(\bar{x},\bar{y},\bar{z})$, generally giving you a point inside the sphere, and then converting this direction back to latitude and longitude, using something like $$\bar{\phi} = \text{atan2}\left(\bar{y},\bar{x}\right) \text{ and } \bar{\lambda} = \text{atan2}\left(\bar{z},\sqrt{\bar{x}^2+\bar{y}^2}\right). $$

Proportionately how far the mean point is inside the sphere, i.e. $\frac{\sqrt{\bar{x}^2+\bar{y}^2+\bar{z}^2}}{R}$, is an indicator of dispersion of the original points.

Related Question