The documentation on ee.ImageCollection.distance says that

Distances are computed on a sphere, so there is a small error proportional to the latitude difference between each pixel and the nearest geometry.

Why does computing on a sphere causes this error? I thought computing on a projection causes this kind of error due to distortion, while distance on unprojected sphere does not.

But I am not sure what sphere is used here.ee.ImageCollection.distance doesn't have a parameter for CRS, so I assume GEE reprojects to EPSG:4326 and plug in the great circle distance formula. This seems weird because we often want to use some local CRS when wanting accurate distance.

  • 2
    The Earth is not a sphere, but a spheroid (actually, it isn't a spheroid, either, but a spheroid is closer match than a sphere)
    – Vince
    Dec 25, 2021 at 3:50
  • Do you mean that "Distances are computed on a sphere" actually means it is computed on a projected CRS?
    – Sara
    Dec 25, 2021 at 3:53
  • 2
    No, I'm pretty sure "Distances are computed on a sphere" means they're computed on a sphere (faster calculation, but less accurate)
    – Vince
    Dec 25, 2021 at 4:49
  • 2
    The more accurate model is an oblate spheroid with ~1/298 flattening. The mismatch in the curves correlates to latitude.
    – Vince
    Dec 25, 2021 at 12:53
  • 1
    I cannot state how GEE has been coded, only my expectation the the radius chosen is optimized for the latitude range in processing, hence the documentation's assertion.
    – Vince
    Dec 26, 2021 at 6:12

1 Answer 1


I think the documentation is wrong.

Although we do not know what the calculation of the distance used is, we can guess that it is the calculation of the orthodromic on a sphere (i.e., the distance measured on the great circle that contains two points).

Regarding the radius of the sphere, I don't think it is calculated based on the location (precisely because they are looking for speed of calculation). Rather, I suspect that the radius of 6378137 m is used. Which is the equatorial radius of the WGS84 ellipsoid, and it is the radius that Google uses to project its map services onto the plane.

Why does computing on a sphere causes this error?

Because the difference between what an arc of circumference measures with respect to an arc of an ellipse. The error varies, although not proportionally, with the width of the arc.

I think the documentation is wrong because the geodesic that passes through two points of equal latitude (except that they are on the equator) is also an ellipse on an ellipsoidal surface. The great circle (on the sphere) does not follow a constant latitude, but rather widens its maximum or minimum latitude depending on the difference in longitude between the two points. So much so that if they are 180 degrees apart in longitude, the orthodrome passes through a pole.

This seems weird because we often want to use some local CRS when wanting accurate distance.

Only if we can't compute the shortest distance on the reference surface (usually an ellipsoid). In that case, instead of using a global projection we look for a local projection, so that the computation of the planimetric distance is not so far from the curved shortest distance on the reference surface.

  • I think what you say make sense, but I haven't figured out how to validate it, so I'll give it an upvote and keep the question open for now.
    – Sara
    Dec 29, 2021 at 14:35

Your Answer

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

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