Mapping Toolbox | ![]() ![]() |
Geographic Means
Consider the problem of calculating the mean position of a collection of geographic points. You might be inclined to simply take the arithmetical mean of the latitudes and longitudes using the standard MATLAB mean
command, but this could be very misleading.
Take two points at the same latitude, 180° apart in longitude, for example (30°N,90°W) and (30°N,90°E). The mean latitude is (30+30)/2=30, which seems right. However, the mean longitude must be (90+(-90))/2=0. From the point of view at the Prime Meridian this seems fine, too. At the 0° meridian, each point has the same longitude difference from the mean. What about the point of view at the Date Line? At the 180° meridian, each point also has the same longitude difference. Why isn't 180° the mean longitude?
This problem is further complicated when some points are at different latitudes. Remember, a degree of longitude at the Arctic Circle covers a much smaller distance than a degree at the Equator.
In fact, in the first example, is 30°N the right mean latitude, either? The mean position of two points should be equidistant from those two points, and further, it should be the equidistant point that minimizes this distance. Is (30°N,0°) a reasonable mean point?
Here is another point, call it (lat,lon)
, that is also equidistant from both points, and the distance is much shorter:
What is this mystery point? The lat
is 90°N, and any lon
will do. The North Pole is the true geographic mean of these two points. Note that the great circle containing both points also runs through the North Pole, and a great circle represents the shortest path between two points.
The Mapping Toolbox includes the function meanm
to determine the geographic mean of any number of points. This is accomplished through the three-dimensional vector addition of all the points. For example, try the following:
This is the answer we now expect. This geographic mean can result in one oddity; if the vectors all cancel each other, the mean is the center of the planet. In this case, the returned mean point is (NaN,NaN) and a warning is displayed. This phenomenon is highly improbable in real data, but can be easily constructed. For example, it occurs when all the points are equally spaced along a great circle. Try taking the geographic mean of (0°,0°), (0°,120°), and (0°,240°), which trisect the Equator.
![]() | Geographic Statistics | Geographic Standard Deviation | ![]() |