[postgis-tickets] [PostGIS] #5235: A problem in unit handling in Geography type
PostGIS
trac at osgeo.org
Wed Sep 7 12:22:45 PDT 2022
#5235: A problem in unit handling in Geography type
-----------------------+--------------------------------
Reporter: sergeyt | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS PostgreSQL
Component: postgis | Version: 3.2.x
Keywords: geography |
-----------------------+--------------------------------
Geography type does not take into account units of the GCS. It assumes the
units to be the degrees. There are some GCS that use other units. For
example, 4807 (https://spatialreference.org/ref/?search=epsg:4807) uses
grads instead of degrees. Here is a bug:
Perform distance on two points defined in 4326
SELECT ST_Distance(
'SRID=4326;POINT(0 0)'::geography,
'SRID=4326;POINT(1 0)'::geography
);
Result is 111319.49079327, which is expected on degree at equator.
Transform the points to 4807 and calculate the distance:
SELECT ST_Distance(
ST_Transform('SRID=4326;POINT(0 0)', 4807)::geography,
ST_Transform('SRID=4326;POINT(1 0)', 4807)::geography
);
Result is 123687.23083618. This is 10% larger than expected.
Transformation from 4326 SELECT ST_AsText(ST_Transform('SRID=4326;POINT(0
0)', 4807)); produces a point in GRADS: "POINT(-2.596322435214223
-0.003215804261427)". Cast to geography apparently does not convert it to
degrees.
So either the geography operator should do conversion of grads to degrees
or the Geography type itself should be taking into account the units of
the GCS.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5235>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list