Opened 2 years ago

Last modified 4 months ago

#5235 new enhancement

A problem in unit handling in Geography type

Reported by: sergeyt Owned by: pramsey
Priority: medium Milestone: PostGIS 3.6.0
Component: postgis Version: 3.2.x
Keywords: geography Cc: sergeyt

Description

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.

Change History (4)

comment:1 by robe, 2 years ago

Milestone: PostGIS PostgreSQLPostGIS 3.2.4

comment:2 by robe, 2 years ago

Milestone: PostGIS 3.2.4PostGIS 3.4.0

This feels more like a feature enhancement.

comment:3 by pramsey, 20 months ago

Milestone: PostGIS 3.4.0PostGIS 3.5.0
Type: defectenhancement

comment:4 by robe, 4 months ago

Milestone: PostGIS 3.5.0PostGIS 3.6.0

I think it's too close to release to be doing any serious changes to geography which sounds like this might be.

Note: See TracTickets for help on using tickets.