[SCM] PostGIS branch master updated. 3.4.0rc1-892-gc72cdb44b

git at osgeo.org git at osgeo.org
Mon Jan 22 13:58:10 PST 2024


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  c72cdb44b4fae8c39a6fdad87da51f353da03371 (commit)
      from  b4e7b5736a799546b491213333d55a6841396234 (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 c72cdb44b4fae8c39a6fdad87da51f353da03371
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Jan 22 13:57:59 2024 -0800

    Revert change to max distance, as it does not conform to original understanding of the function (max distance between points in the pairing), references #5639

diff --git a/liblwgeom/measures.c b/liblwgeom/measures.c
index 240b39bc6..b22b2cca1 100644
--- a/liblwgeom/measures.c
+++ b/liblwgeom/measures.c
@@ -238,17 +238,6 @@ lw_dist2d_comp(const LWGEOM *lw1, const LWGEOM *lw2, DISTPTS *dl)
 	return lw_dist2d_recursive(lw1, lw2, dl);
 }
 
-static int
-lw_dist2d_zero(DISTPTS *dl, const POINT2D *pt1, const POINT2D *pt2)
-{
-	dl->distance = 0.0;
-	if (pt1)
-		dl->p1 = *pt1;
-	if (pt2)
-		dl->p2 = *pt2;
-	return LW_TRUE;
-}
-
 static int
 lw_dist2d_is_collection(const LWGEOM *g)
 {
@@ -653,6 +642,10 @@ lw_dist2d_point_poly(LWPOINT *point, LWPOLY *poly, DISTPTS *dl)
 {
 	const POINT2D *p = getPoint2d_cp(point->point, 0);
 
+	/* Max distance? Check only outer ring.*/
+	if (dl->mode == DIST_MAX)
+		return lw_dist2d_pt_ptarray(p, poly->rings[0], dl);
+
 	/* Return distance to outer ring if not inside it */
 	if (ptarray_contains_point(poly->rings[0], p) == LW_OUTSIDE)
 		return lw_dist2d_pt_ptarray(p, poly->rings[0], dl);
@@ -668,7 +661,10 @@ lw_dist2d_point_poly(LWPOINT *point, LWPOLY *poly, DISTPTS *dl)
 			return lw_dist2d_pt_ptarray(p, poly->rings[i], dl);
 
 	/* Is inside the polygon */
-	return lw_dist2d_zero(dl, p, p);
+	dl->distance = 0.0;
+	dl->p1.x = dl->p2.x = p->x;
+	dl->p1.y = dl->p2.y = p->y;
+	return LW_TRUE;
 }
 
 int
@@ -766,7 +762,12 @@ lw_dist2d_line_poly(LWLINE *line, LWPOLY *poly, DISTPTS *dl)
 
 	/* Not in hole, so inside polygon */
 	if (dl->mode == DIST_MIN)
-		return lw_dist2d_zero(dl, p, p);
+	{
+		dl->distance = 0.0;
+		dl->p1.x = dl->p2.x = pt->x;
+		dl->p1.y = dl->p2.y = pt->y;
+	}
+	return LW_TRUE;
 }
 
 int

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

Summary of changes:
 liblwgeom/measures.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list