I am very confused about the measurements of ST_Distance in PostGIS. If I measure along the equator I get longer measurements using the SPHEROID instead of the sphere, but only up to 179 degrees (and this makes sense since distance on a spheroid is obviously longer). From 180 degrees + this turns around and SPHERE surpisingly yields longer results
SELECT ST_Distance(ST_Point(0,0), ST_Point(179,0), True)/1000 AS spheroid_dist,
ST_Distance(ST_Point(0,0), ST_Point(179,0), False)/1000 AS sphere_dist;
outputs
spheroid_distance;sphere_distance
19926.1888494779;19903.9192724991
while
SELECT ST_Distance(ST_Point(0,0), ST_Point(180,0), True)/1000 AS spheroid_dist,
ST_Distance(ST_Point(0,0), ST_Point(180,0), False)/1000 AS sphere_dist;
outputs
spheroid_distance;sphere_distance
19903.5933909347;20015.1143522337
To make it more confusing I get different results for the spheroid measurement for different PostGIS versions. Above are results for Version 2.1
Version 2.3 yields the following results (for the second SELECT statement, i.e. 180 degrees):
spheroid_distance;sphere_distance
20003.9314586255;20015.1143522337
So what numbers are to be trusted? Can anyone shed some light?