[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha2-148-g4f1fecf

git at osgeo.org git at osgeo.org
Thu Nov 5 12:55:05 PST 2020


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  4f1fecf2ebc73f2e4d508906f7a73fc77aa0e2f8 (commit)
      from  826ac5c18ce176772f74f3661daa83fe3272643c (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 4f1fecf2ebc73f2e4d508906f7a73fc77aa0e2f8
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu Nov 5 12:54:42 2020 -0800

    Return positive azimuth values per the documentation.
    Closes #4718

diff --git a/liblwgeom/lwgeodetic.c b/liblwgeom/lwgeodetic.c
index 1409f29..aa3d278 100644
--- a/liblwgeom/lwgeodetic.c
+++ b/liblwgeom/lwgeodetic.c
@@ -2156,7 +2156,7 @@ LWPOINT* lwgeom_project_spheroid(const LWPOINT *r, const SPHEROID *spheroid, dou
 double lwgeom_azumith_spheroid(const LWPOINT *r, const LWPOINT *s, const SPHEROID *spheroid)
 {
 	GEOGRAPHIC_POINT g1, g2;
-	double x1, y1, x2, y2;
+	double x1, y1, x2, y2, az;
 
 	/* Convert r to a geodetic point */
 	x1 = lwpoint_get_x(r);
@@ -2175,7 +2175,9 @@ double lwgeom_azumith_spheroid(const LWPOINT *r, const LWPOINT *s, const SPHEROI
 	}
 
 	/* Do the direction calculation */
-	return spheroid_direction(&g1, &g2, spheroid);
+	az = spheroid_direction(&g1, &g2, spheroid);
+	/* Ensure result is positive */
+	return az > 0 ? az : M_PI - az;
 }
 
 /**
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index 9d87199..8631de7 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1299,3 +1299,14 @@ SELECT '#4670-5', ST_AsEWKT(ST_AddPoint('LINESTRING(0 0, 1 1, 3 3, 4 4)'::geomet
 SELECT '#4689', _ST_DistanceTree('POLYGON ((30 10, 40 40, 20 40, 30 10))'::geography, 'POLYGON((81 6,140 35,-70 18,-51 0,-60 -46,106 -6,81 6))');
 
 SELECT '#4748', ST_AsEWKT(ST_Transform(ST_SetSRID(ST_Point(-36.75, -54.25), 4326), 3031),1);
+
+SELECT '#4718',
+	round(degrees(
+	ST_Azimuth('POINT(77.46412 37.96999)'::geography,
+           'POINT(77.46409 37.96999)'::geography
+           ))::numeric,3),
+	round(degrees(
+	ST_Azimuth('POINT(77.46412 37.96999)'::geography,
+           'POINT(77.46429 37.96999)'::geography
+           ))::numeric,3);
+
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index c4a63c7..f520039 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -435,3 +435,4 @@ ERROR:  BOX2D_construct: args can not be empty points
 ERROR:  LWGEOM_addpoint: Invalid offset
 #4689|0
 #4748|SRID=3031;POINT(-2399498.7 3213318.5)
+#4718|270.000|90.000

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

Summary of changes:
 liblwgeom/lwgeodetic.c        |  6 ++++--
 regress/core/tickets.sql      | 11 +++++++++++
 regress/core/tickets_expected |  1 +
 3 files changed, 16 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list