I have latitude longitude coordinates covering the whole globe that I wish to perform arithmetic operations (mean, interpolation) on without concern for ambiguous points and wrap around and without using geographic coordinate specific implementations.

In order to do this, I plan to convert these coordinates to a cartesian form.

i.e. for the position

29.7604° N, 95.3698° W

r=1 φ=29.764°, r=1 φ=95.3698°

I intend to then convert these polar coordinates to Cartesian coordinates

x=cos(29.764°) y=sin(29.764°), x=cos(95.3698°) y=sin(95.3698°)

In this Cartesian form can I then safely perform operations such as mean and linear interpolation?

I found this question/answer that seems to imply that the Cartesian form is insufficient, and that I would need a geographic specific representation: Averaging Cartesian ECEF coordinates then converting to WGS84 without latitude drift

But then I found this question/answer that seems to imply my strategy might just work: Computing an averaged latitude and longitude coordinates

What is the correct way to handle this?

1 Answer 1


Assuming that you do not worry about the errors produced by treating geographic coordinates as spherical coordinates instead of ellipsoidal ones.

When applying these formulas you are obtaining two planes, one plane for the latitudes and another plane for the longitudes. And for each of them, a couple of Cartesian coordinates.

In the plane of the latitudes, all of them are being treated as if they belonged to the same meridian. In the plane of the longitudes, all of them are being treated as if they belonged to the same parallel.

This is because you are separating the spherical coordinates into two two-dimensional spaces with polar coordinates. Where the radius is the common coordinate to both. That is, from three spherical coordinates [(radius, latitude, longitude)], you are obtaining two pairs of polar coordinates [(radius, latitude) ; (radius, longitude)], and from there converting to two pairs of Cartesian coordinates [(x, y) ; (x, y)].

Now suppose you have a point located at longitude = 0 and latitude = 0. And another point located in the North pole (assume longitude = 0 and latitude = 90). And you want to know the position of the 1/3 of the line between them. The distance between parallels is the same in the sphere, regardless of the longitude they are. Therefore, the point will be in longitude = 0 and latitude = 30 degrees.

But, what happens if you interpolate them in a Cartesian system (transforming only the latitudes from a sphere with radius = 1). One point is in x = 1, y = 0. The other is in x = 0, y = 1. The interpolated point is in x = 2/3, y = 1/3. And the arctangent of ((1/3) / (2/3)) is not 30 degrees. Draw them and you will understand the problem.

That method can work for the aritmethic mean between two positions. But as soon as you try to average more than two positions, the result becomes wrong again.

From https://en.wikipedia.org/wiki/Mean_of_circular_quantities#Mean_of_angles:

This computation produces a different result than the arithmetic mean, with the difference being greater when the angles are widely distributed. For example, the arithmetic mean of the three angles 0°, 0° and 90° is (0+0+90)/3 = 30°, but the vector mean is 26.565°.

For the longitudes, the calculation proposed will be worst. Because the distance between meridians is a function of the latitude in wich the distance is measured. Two points separated by one degree of longitude are separated by a different distance according to what latitude they are. That is, longitudes can not be treated as if they all belong to the same latitude.

Therefore, the correct way to handle this depends a little on the particular conditions and needs. As a general rule, the conversion to the geocentric system of Cartesian coordinates works well for locations close to each other. But in the same 3D system, not in two 2D systems.

For means of more than two locations, or interpolations, of points that are not relatively close to each other, we will have to sit down with some books in hand to analyze the best solution for the particular need that arises.

  • To describe my use case, I need to handle high frequency time series GPS data (vehicles) that can span large distances (continental Asia). I want to interpolate vehicle position and downsample by averaging position in the same minute or hour. Given this use cases, interpolation doesn't typically occur across distances of ~100mile radius and mean values don't occur for positions greater than 100miles apart. Would you recommend the ECEF geographic coordinate system? Mar 12, 2019 at 2:36
  • Yes, mainly because you need an automated task. I hope that the accuracy achieved is enough for you. My intention was only to demonstrate that the extended method of converting geographical coordinates to Cartesian inevitably produces an error in the result of the arithmetic mean between more than two positions, or interpolation to positions different from the midpoint between two others. Mar 12, 2019 at 9:41
  • In passing, clarify that the formulas included in the question are not correct, but you must convert to x, y, z coordinates. Mar 12, 2019 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.