[SCM] PostGIS branch master updated. 3.4.0rc1-875-g51ff306d3

git at osgeo.org git at osgeo.org
Tue Jan 9 12:44:57 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  51ff306d3f32217d00e9511cfe9463ddb0523adb (commit)
      from  c5b42369ac1ee6ea87433e6237bfb19505976dc8 (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 51ff306d3f32217d00e9511cfe9463ddb0523adb
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Jan 9 12:44:47 2024 -0800

    Fix logic mistake in ST_Covers for geography

diff --git a/liblwgeom/lwgeodetic.c b/liblwgeom/lwgeodetic.c
index 89cf47589..982e4e4af 100644
--- a/liblwgeom/lwgeodetic.c
+++ b/liblwgeom/lwgeodetic.c
@@ -2637,23 +2637,10 @@ int lwpoly_covers_lwpoly(const LWPOLY *poly1, const LWPOLY *poly2)
 	/* check if all vertices of poly2 are inside poly1 */
 	for (i = 0; i < poly2->nrings; i++)
 	{
-
-		/* every other ring is a hole, check if point is inside the actual polygon */
-		if ( i % 2 == 0)
+		if (LW_FALSE == lwpoly_covers_pointarray(poly1, poly2->rings[i]))
 		{
-			if (LW_FALSE == lwpoly_covers_pointarray(poly1, poly2->rings[i]))
-			{
-				LWDEBUG(4,"returning false, geometry2 has point outside of geometry1");
-				return LW_FALSE;
-			}
-		}
-		else
-		{
-			if (LW_TRUE == lwpoly_covers_pointarray(poly1, poly2->rings[i]))
-			{
-				LWDEBUG(4,"returning false, geometry2 has point inside a hole of geometry1");
-				return LW_FALSE;
-			}
+			LWDEBUG(4,"returning false, geometry2 has point outside of geometry1");
+			return LW_FALSE;
 		}
 	}
 
diff --git a/regress/core/geography_covers.sql b/regress/core/geography_covers.sql
index 2bae7880e..721f2431a 100644
--- a/regress/core/geography_covers.sql
+++ b/regress/core/geography_covers.sql
@@ -42,3 +42,9 @@ SELECT c, ST_Covers(g::geography, g::geography) FROM
     ('geog_covers_self_line', 'LINESTRING (35 35, 35 15, 15 15)'),
     ('geog_covers_self_polygon', 'POLYGON((0 40, 40 40, 40 0, 0 0, 0 40))')
 ) AS u(c, g)
+
+-- donut covers
+SELECT 'geog_covers_donut', ST_Covers(
+	ST_BUFFER('Point(0 0)'::geography, 50000),
+	'Polygon((0.1 0.2, 0.1 0.3, 0.2 0.3, 0.2 0.2, 0.1 0.2), (0.15 0.22, 0.15 0.25, 0.18 0.25, 0.18 0.22, 0.15 0.22))'::geography
+	);
diff --git a/regress/core/geography_covers_expected b/regress/core/geography_covers_expected
index 792ccc537..e35d961af 100644
--- a/regress/core/geography_covers_expected
+++ b/regress/core/geography_covers_expected
@@ -17,3 +17,4 @@ geog_covered_poly_line_out|f
 geog_covers_self_point|t
 geog_covers_self_line|t
 geog_covers_self_polygon|t
+geog_covers_donut|t
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index c07cbf688..be93a47cb 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1526,3 +1526,4 @@ SELECT '#5604',
 FROM
 ST_GeomFromText('MULTIPOINT((-2 0), EMPTY)') AS a1,
 ST_GeomFromText('MULTIPOINT((1 0),(0 0))') AS a2;
+

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

Summary of changes:
 liblwgeom/lwgeodetic.c                 | 19 +++----------------
 regress/core/geography_covers.sql      |  6 ++++++
 regress/core/geography_covers_expected |  1 +
 regress/core/tickets.sql               |  1 +
 4 files changed, 11 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list