Opened 9 years ago

Closed 9 years ago

#3201 closed defect (fixed)

ST_DistanceSphere uses SRID to obtain spheroid

Reported by: Mike Taves Owned by: robe
Priority: medium Milestone: PostGIS 2.2.0
Component: documentation Version: master
Keywords: Cc:

Description

The manual claims that "[ST_DistanceSphere] currently does not look at the SRID of a geometry and will always assume its in WGS 84 long lat." However, since PostGIS 2.0, it does use a valid SRID to get the spheroid.

Compare this, using PostGIS 2.0:

SELECT
  ST_Distance_Sphere(p1, p2) AS default,
  ST_Distance_Sphere(ST_SetSRID(p1, 4326), ST_SetSRID(p2, 4326)) AS wgs_84,
  ST_Distance_Sphere(ST_SetSRID(p1, 4269), ST_SetSRID(p2, 4269)) AS grs_1980
FROM (
    SELECT ST_MakePoint(0, 0) AS p1, ST_MakePoint(0, 1) AS p2
) f;
-[ RECORD 1 ]--------------
default  | 111195.079734632
wgs_84   | 111195.079734632
grs_1980 | 111195.079734022

The distances for unknown SRID and WGS84 are identical. But are different for GRS80.

Change History (1)

comment:1 by pramsey, 9 years ago

Resolution: fixed
Status: newclosed

Fixed at r13840

Note: See TracTickets for help on using tickets.