From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: jan.heckman@gmail.com
Subject: BUG #17037: ST_Azimuth used with geography produces results not in accordance with documentation
Date: Wed, 26 May 2021 18:15:15 +0000
Message-ID: <17037-46082c9d261f8cd8@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17037
Logged by: Jan Heckman
Email address: jan.heckman@gmail.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, jan.heckman@gmail.com
Subject: Re: BUG #17037: ST_Azimuth used with geography produces results not in accordance with documentation
In-Reply-To: <17037-46082c9d261f8cd8@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox