5
$\begingroup$

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

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

Thanks!

  • 1
    @Arturo: There might be a problem if for example all of the points are in the Pacific but the average longitude is in Africa.2011-06-26

1 Answers 1

4

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.

  • 0
    That's what I needed. Thank you!2011-06-26