From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | jan(dot)heckman(at)gmail(dot)com |
Subject: | BUG #17037: ST_Azimuth used with geography produces results not in accordance with documentation |
Date: | 2021-05-26 18:15:15 |
Message-ID: | 17037-46082c9d261f8cd8@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 17037
Logged by: Jan Heckman
Email address: jan(dot)heckman(at)gmail(dot)com
PostgreSQL version: 11.11
Operating system: windows 10 pro 21H1
Description:
The following queries illustrate that ST_Azimuth can fail to follow
https://postgis.net/docs/ST_Azimuth.html with dy < 0 and dx < 0.
The first three queries produce correct results, the last one does not:
select degrees(st_azimuth('POINT(0 1)'::geometry,'POINT(0 0)'::geometry));
degrees
---------
180
(1 row)
select degrees(st_azimuth('POINT(0 1)'::geography,'POINT(0
0)'::geography));
degrees
---------
180
(1 row)
select degrees(st_azimuth('POINT(0 1)'::geometry,'POINT(-0.01
0)'::geometry));
degrees
------------------
180.572938697683
(1 row)
select degrees(st_azimuth('POINT(0 1)'::geography,'POINT(-0.01
0)'::geography));
degrees
------------------
359.423171739084
(1 row)
This behavior occurs also with less 'nice' inputs, e.g.
select degrees(st_azimuth(ST_POINT(4.76389,
52.308601)::geography,'POINT(4.43722 51.956902)'::geography));
degrees
-----------------
330.11876325276
This is NOT the course to fly from airport AMS to airport RTM.
Doing the query with geometry instead of geography produces a better result,
but should be inaccurate for greater distances:
select degrees(st_azimuth(ST_POINT(4.76389,
52.308601)::geometry,'POINT(4.43722 51.956902)'::geometry));
degrees
------------------
222.886982058682
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-05-26 19:08:42 | Re: BUG #17037: ST_Azimuth used with geography produces results not in accordance with documentation |
Previous Message | Tom Lane | 2021-05-26 17:47:53 | Re: BUG #17035: assert after commit |