[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0rc1-94-ga97223f

git at osgeo.org git at osgeo.org
Thu Feb 18 10:14:10 PST 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  a97223f2ad9a570bf1a78a539c592bf2dc681c50 (commit)
      from  5363724d5d1c1cbc1bf6eb3c42c18b970c192c14 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a97223f2ad9a570bf1a78a539c592bf2dc681c50
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu Feb 18 09:46:52 2021 -0800

    Mistake in converting negative azimuth values to positive
    results in incorrect azimuths in geography.
    Closes #4840

diff --git a/liblwgeom/lwgeodetic.c b/liblwgeom/lwgeodetic.c
index cac4310..f847bb4 100644
--- a/liblwgeom/lwgeodetic.c
+++ b/liblwgeom/lwgeodetic.c
@@ -2177,7 +2177,8 @@ double lwgeom_azumith_spheroid(const LWPOINT *r, const LWPOINT *s, const SPHEROI
 	/* Do the direction calculation */
 	az = spheroid_direction(&g1, &g2, spheroid);
 	/* Ensure result is positive */
-	return az > 0 ? az : M_PI - az;
+	return az < -0 ? 2*M_PI + az : az;
+	// return az;
 }
 
 /**
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index c73b72a..52ced3b 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1319,5 +1319,26 @@ SELECT '#4796', st_astext(st_snaptogrid(st_normalize(st_simplifypreservetopology
 
 SELECT '#4812', st_srid('SRID=999999;POINT(1 1)'::geometry);
 
+SELECT
+'#4840',
+round(degrees(ST_azimuth(C,N)))  AS az_n,
+round(degrees(ST_azimuth(C,NE))) AS az_ne,
+round(degrees(ST_azimuth(C,E)))  AS az_e,
+round(degrees(ST_azimuth(C,SE))) AS az_se,
+round(degrees(ST_azimuth(C,S)))  AS az_s,
+round(degrees(ST_azimuth(C,SW))) AS az_sw,
+round(degrees(ST_azimuth(C,W)))  AS az_w,
+round(degrees(ST_azimuth(C,NW))) AS az_nw
+FROM (SELECT
+'POINT(5 55)'::geography AS C,
+'POINT(5 56)'::geography AS N,
+'POINT(6 56)'::geography AS NE,
+'POINT(6 55)'::geography AS E,
+'POINT(6 54)'::geography AS SE,
+'POINT(5 54)'::geography AS S,
+'POINT(4 54)'::geography AS SW,
+'POINT(4 55)'::geography AS W,
+'POINT(4 56)'::geography AS NW ) points;
+
 SELECT '#4853', ST_ClusterDBSCAN(geom,  eps := 0.000906495804256269, minpoints := 4) OVER() AS cid FROM (VALUES ('0101000020E6100000E4141DC9E5934B40D235936FB6193940'::geometry), ('0101000020E6100000C746205ED7934B40191C25AFCE193940'::geometry), ('0101000020E6100000C780ECF5EE934B40B6BE4868CB193940'::geometry), ('0101000020E6100000ABB2EF8AE0934B404451A04FE4193940'::geometry)) AS t(geom);
 
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index 515b09f..03609b2 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -439,6 +439,7 @@ ERROR:  LWGEOM_addpoint: Invalid offset
 #4727|0
 #4796|POLYGON((178632 397744,178738 397769,178745 397741,178749 397742,178752 397727,178748 397726,178759 397684,178699 397669,178694 397691,178646 397680,178632 397744))
 #4812|999999
+#4840|0|29|90|149|180|211|270|331
 #4853|0
 #4853|0
 #4853|0

-----------------------------------------------------------------------

Summary of changes:
 liblwgeom/lwgeodetic.c        |  3 ++-
 regress/core/tickets.sql      | 21 +++++++++++++++++++++
 regress/core/tickets_expected |  1 +
 3 files changed, 24 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list