[postgis-tickets] [SCM] PostGIS branch stable-3.1 updated. 3.1.9-5-gc7b679c37

git at osgeo.org git at osgeo.org
Tue Jun 20 17:30:52 PDT 2023


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, stable-3.1 has been updated
       via  c7b679c37d866d29772946d565a0ffd9c0ac36c2 (commit)
       via  3fab2fff3829571544575e7f66023fae8ba89c45 (commit)
      from  978c936cffc3c0c4bd5450cc5d1aed7b9acc2bdb (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 c7b679c37d866d29772946d565a0ffd9c0ac36c2
Author: Regina Obe <lr at pcorp.us>
Date:   Fri Apr 21 01:35:05 2023 -0400

    Change gdal polygonize tests to be sum of areas and values
    instead of checking individual elements.
    This is to account for GDAL 3.7 results array sorted in different order
    from prior versions.
    References #5366 for PostGIS 3.1.10

diff --git a/raster/test/cunit/cu_gdal.c b/raster/test/cunit/cu_gdal.c
index 54daa3ebd..c20da3b43 100644
--- a/raster/test/cunit/cu_gdal.c
+++ b/raster/test/cunit/cu_gdal.c
@@ -155,6 +155,8 @@ static void test_gdal_polygonize() {
 	int i;
 	rt_raster rt;
 	int nPols = 0;
+	double total_area = 0;
+	double total_val = 0;
 	rt_geomval gv = NULL;
 	LWGEOM *gexpected, *gobserved;
 	//char *wkt = NULL;
@@ -166,32 +168,18 @@ static void test_gdal_polygonize() {
 
 	nPols = 0;
 	gv = rt_raster_gdal_polygonize(rt, 0, TRUE, &nPols);
+	CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
+		total_area = 0; total_val = 0;
+	for (i = 0; i < nPols; i++) {
+		total_val += gv[i].val;
+		gobserved = (LWGEOM *) gv[i].geom;
+		total_area += lwgeom_area(gobserved);
+		lwgeom_free((LWGEOM *) gv[i].geom);
+	}
+	printf("total area, total val, nPols  = %f, %f, %i\n", total_area, total_val, nPols);
+	CU_ASSERT_DOUBLE_EQUAL(total_val, 1.8 + 0.0 + 2.8 + 0, FLT_EPSILON);
+	CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
 
-	CU_ASSERT_DOUBLE_EQUAL(gv[0].val, 1.8, FLT_EPSILON);
-
-	gobserved = (LWGEOM *)gv[0].geom;
-
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
-	CU_ASSERT_DOUBLE_EQUAL(gv[1].val, 0.0, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[1].geom;
-	gexpected = lwgeom_from_wkt("POLYGON((3 3,3 6,6 6,6 3,3 3))", LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON );
-
-	CU_ASSERT_DOUBLE_EQUAL(gv[2].val, 2.8, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[2].geom;
-	gexpected = lwgeom_from_wkt("POLYGON((5 1,5 3,6 3,6 6,5 6,5 8,6 8,6 7,7 7,7 6,8 6,8 3,7 3,7 2,6 2,6 1,5 1))",
-				    LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
-	gobserved = (LWGEOM *)gv[3].geom;
-	gexpected = lwgeom_from_wkt(
-	    "POLYGON((0 0,0 9,9 9,9 0,0 0),(6 7,6 8,3 8,3 7,2 7,2 6,1 6,1 3,2 3,2 2,3 2,3 1,6 1,6 2,7 2,7 3,8 3,8 6,7 6,7 7,6 7))",
-	    LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(gv[3].val, 0.0, FLT_EPSILON);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
-	for (i = 0; i < nPols; i++) lwgeom_free((LWGEOM *) gv[i].geom);
 	rtdealloc(gv);
 	cu_free_raster(rt);
 
@@ -203,40 +191,19 @@ static void test_gdal_polygonize() {
 
 	nPols = 0;
 	gv = rt_raster_gdal_polygonize(rt, 0, TRUE, &nPols);
-
-	/*
+	CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
+	total_area = 0; total_val = 0;
 	for (i = 0; i < nPols; i++) {
-		wkt = lwgeom_to_text((const LWGEOM *) gv[i].geom);
-		printf("(i, val, geom) = (%d, %f, %s)\n", i, gv[i].val, wkt);
-		rtdealloc(wkt);
+		total_val += gv[i].val;
+		gobserved = (LWGEOM *) gv[i].geom;
+		total_area += lwgeom_area(gobserved);
+		lwgeom_free((LWGEOM *) gv[i].geom);
 	}
-	*/
+	printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
+	CU_ASSERT_DOUBLE_EQUAL(total_val, 4.6, FLT_EPSILON);
+	CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
+
 
-	CU_ASSERT_DOUBLE_EQUAL(gv[1].val, 0.0, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[1].geom;
-	gexpected = lwgeom_from_wkt("POLYGON((3 3,3 6,6 6,6 3,3 3))", LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-	//wkt = lwgeom_to_text((const LWGEOM *) gv[1].geom);
-	//CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((3 3,3 6,6 6,6 3,3 3))");
-	//rtdealloc(wkt);
-
-	CU_ASSERT_DOUBLE_EQUAL(gv[2].val, 2.8, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[2].geom;
-	gexpected = lwgeom_from_wkt("POLYGON((5 1,5 3,6 3,6 6,5 6,5 8,6 8,6 7,7 7,7 6,8 6,8 3,7 3,7 2,6 2,6 1,5 1))",
-				    LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-	//wkt = lwgeom_to_text((const LWGEOM *) gv[2].geom);
-	//CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((5 1,5 3,6 3,6 6,5 6,5 8,6 8,6 7,7 7,7 6,8 6,8 3,7 3,7 2,6 2,6 1,5 1))");
-	//rtdealloc(wkt);
-
-	CU_ASSERT_DOUBLE_EQUAL(gv[3].val, 0.0, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[3].geom;
-	gexpected = lwgeom_from_wkt(
-	    "POLYGON((0 0,0 9,9 9,9 0,0 0),(6 7,6 8,3 8,3 7,2 7,2 6,1 6,1 3,2 3,2 2,3 2,3 1,6 1,6 2,7 2,7 3,8 3,8 6,7 6,7 7,6 7))",
-	    LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
-	for (i = 0; i < nPols; i++) lwgeom_free((LWGEOM *) gv[i].geom);
 	rtdealloc(gv);
 	cu_free_raster(rt);
 
@@ -248,33 +215,19 @@ static void test_gdal_polygonize() {
 
 	nPols = 0;
 	gv = rt_raster_gdal_polygonize(rt, 0, TRUE, &nPols);
-
-	/*
+	CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
+	total_area = 0; total_val = 0;
 	for (i = 0; i < nPols; i++) {
-		wkt = lwgeom_to_text((const LWGEOM *) gv[i].geom);
-		printf("(i, val, geom) = (%d, %f, %s)\n", i, gv[i].val, wkt);
-		rtdealloc(wkt);
+		total_val += gv[i].val;
+		gobserved = (LWGEOM *) gv[i].geom;
+		total_area += lwgeom_area(gobserved);
+		lwgeom_free((LWGEOM *) gv[i].geom);
 	}
-	*/
-
-	CU_ASSERT_DOUBLE_EQUAL(gv[3].val, 0.0, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[3].geom;
-	gexpected = lwgeom_from_wkt(
-	    "POLYGON((0 0,0 9,9 9,9 0,0 0),(6 7,6 8,3 8,3 7,2 7,2 6,1 6,1 3,2 3,2 2,3 2,3 1,6 1,6 2,7 2,7 3,8 3,8 6,7 6,7 7,6 7))",
-	    LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
-	gobserved = (LWGEOM *)gv[0].geom;
-	gexpected = lwgeom_from_wkt(
-	    "POLYGON((3 1,3 2,2 2,2 3,1 3,1 6,2 6,2 7,3 7,3 8,5 8,5 6,3 6,3 3,4 3,5 3,5 1,3 1))", LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
 
-	CU_ASSERT_DOUBLE_EQUAL(gv[1].val, 0.0, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[1].geom;
-	gexpected = lwgeom_from_wkt("POLYGON((3 3,3 6,6 6,6 3,3 3))", LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
+	printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
+	CU_ASSERT_DOUBLE_EQUAL(total_val, 4.6, FLT_EPSILON);
+	CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
 
-	for (i = 0; i < nPols; i++) lwgeom_free((LWGEOM *) gv[i].geom);
 	rtdealloc(gv);
 	cu_free_raster(rt);
 
@@ -286,26 +239,19 @@ static void test_gdal_polygonize() {
 	nPols = 0;
 	gv = rt_raster_gdal_polygonize(rt, 0, TRUE, &nPols);
 
-	/*
+	CU_ASSERT_DOUBLE_EQUAL(nPols, 2, FLT_EPSILON);
+	total_area = 0; total_val = 0;
 	for (i = 0; i < nPols; i++) {
-		wkt = lwgeom_to_text((const LWGEOM *) gv[i].geom);
-		printf("(i, val, geom) = (%d, %f, %s)\n", i, gv[i].val, wkt);
-		rtdealloc(wkt);
+		total_val += gv[i].val;
+		gobserved = (LWGEOM *) gv[i].geom;
+		total_area += lwgeom_area(gobserved);
+		lwgeom_free((LWGEOM *) gv[i].geom);
 	}
-	*/
-
-	CU_ASSERT_DOUBLE_EQUAL(gv[0].val, 1.8, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[0].geom;
-	gexpected = lwgeom_from_wkt("POLYGON((3 1,3 2,2 2,2 3,1 3,1 6,2 6,2 7,3 7,3 8,5 8,5 6,3 6,3 3,4 3,5 3,5 1,3 1))", LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
 
-	CU_ASSERT_DOUBLE_EQUAL(gv[1].val, 2.8, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[1].geom;
-	gexpected = lwgeom_from_wkt("POLYGON((5 1,5 3,6 3,6 6,5 6,5 8,6 8,6 7,7 7,7 6,8 6,8 3,7 3,7 2,6 2,6 1,5 1))",
-				    LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
+	printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
+	CU_ASSERT_DOUBLE_EQUAL(total_val, 4.6, FLT_EPSILON);
+	CU_ASSERT_DOUBLE_EQUAL(total_area, 28, FLT_EPSILON);
 
-	for (i = 0; i < nPols; i++) lwgeom_free((LWGEOM *) gv[i].geom);
 	rtdealloc(gv);
 	cu_free_raster(rt);
 
@@ -317,39 +263,18 @@ static void test_gdal_polygonize() {
 	nPols = 0;
 	gv = rt_raster_gdal_polygonize(rt, 0, TRUE, &nPols);
 
-	/*
+	CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
+	total_area = 0; total_val = 0;
 	for (i = 0; i < nPols; i++) {
-		wkt = lwgeom_to_text((const LWGEOM *) gv[i].geom);
-		printf("(i, val, geom) = (%d, %f, %s)\n", i, gv[i].val, wkt);
-		rtdealloc(wkt);
+		total_val += gv[i].val;
+		gobserved = (LWGEOM *) gv[i].geom;
+		total_area += lwgeom_area(gobserved);
+		lwgeom_free((LWGEOM *) gv[i].geom);
 	}
-	*/
 
-	CU_ASSERT_DOUBLE_EQUAL(gv[0].val, 1.8, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[0].geom;
-	gexpected = lwgeom_from_wkt(
-	    "POLYGON((3 1,3 2,2 2,2 3,1 3,1 6,2 6,2 7,3 7,3 8,5 8,5 6,3 6,3 3,4 3,5 3,5 1,3 1))", LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
-	CU_ASSERT_DOUBLE_EQUAL(gv[1].val, 0.0, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[1].geom;
-	gexpected = lwgeom_from_wkt("POLYGON((3 3,3 6,6 6,6 3,3 3))", LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
-	CU_ASSERT_DOUBLE_EQUAL(gv[2].val, 2.8, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[2].geom;
-	gexpected = lwgeom_from_wkt("POLYGON((5 1,5 3,6 3,6 6,5 6,5 8,6 8,6 7,7 7,7 6,8 6,8 3,7 3,7 2,6 2,6 1,5 1))",
-				    LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
-	CU_ASSERT_DOUBLE_EQUAL(gv[3].val, 0.0, FLT_EPSILON);
-	gobserved = (LWGEOM *)gv[3].geom;
-	gexpected = lwgeom_from_wkt(
-	    "POLYGON((0 0,0 9,9 9,9 0,0 0),(6 7,6 8,3 8,3 7,2 7,2 6,1 6,1 3,2 3,2 2,3 2,3 1,6 1,6 2,7 2,7 3,8 3,8 6,7 6,7 7,6 7))",
-	    LW_PARSER_CHECK_NONE);
-	CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
-	for (i = 0; i < nPols; i++) lwgeom_free((LWGEOM *) gv[i].geom);
+	printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
+	CU_ASSERT_DOUBLE_EQUAL(total_val, 1.8 + 0.0 + 2.8 + 0.0, FLT_EPSILON);
+	CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
 	rtdealloc(gv);
 	cu_free_raster(rt);
 }

commit 3fab2fff3829571544575e7f66023fae8ba89c45
Author: Regina Obe <lr at pcorp.us>
Date:   Tue Jun 20 20:19:15 2023 -0400

    Revise offset_curve regress tests to pass
    on newer GEOS
    Closes #5391 for PostGIS 3.1.10

diff --git a/regress/core/offsetcurve.sql b/regress/core/offsetcurve.sql
index 0e3e593e8..3bb1fcf9b 100644
--- a/regress/core/offsetcurve.sql
+++ b/regress/core/offsetcurve.sql
@@ -13,7 +13,7 @@ SELECT 't5b', ST_AsEWKT(ST_Normalize(ST_OffsetCurve(
  'SRID=42;LINESTRING(0 0, 10 0, 10 10)', 10)));
 SELECT 't6', ST_AsEWKT(ST_Normalize(ST_SnapToGrid(ST_OffsetCurve(
  'SRID=42;LINESTRING(0 0, 10 0, 10 10)', -10,
- 'quad_segs=2'),1)));
+ 'quad_segs=8'),1)));
 SELECT 't7', ST_AsEWKT(ST_Normalize(ST_OffsetCurve(
  'SRID=42;LINESTRING(0 0, 10 0, 10 10)', -10,
  'join=bevel'))
@@ -22,10 +22,9 @@ SELECT 't8', ST_AsEWKT(ST_Normalize(ST_SnapToGrid(ST_OffsetCurve(
  'SRID=42;LINESTRING(0 0, 10 0, 10 10)', -10,
  'quad_segs=2 join=mitre'),
 1)));
-/**SELECT 't9', ST_AsEWKT(ST_SnapToGrid(ST_OffsetCurve(
- 'SRID=42;LINESTRING(0 0, 10 0, 5 10)', -10,
- 'quad_segs=2 join=mitre mitre_limit=1'),
-1));**/
+-- SELECT 't9', ST_AsEWKT(ST_Normalize(ST_SnapToGrid(ST_OffsetCurve(
+--  'SRID=42;LINESTRING(0 0, 10 0, 5 10)', -10,
+--  'quad_segs=2 join=mitre mitre_limit=1'),1)));
 SELECT 't10', ST_AsEWKT(ST_Normalize(ST_SnapToGrid(ST_OffsetCurve(
  'SRID=42;LINESTRING(0 0, 10 0, 5 10)', 2,
  'quad_segs=2 join=mitre mitre_limit=1'),
@@ -42,18 +41,18 @@ SELECT 't12', ST_AsText(ST_Normalize(ST_SnapToGrid(ST_OffsetCurve(
  'LINESTRING(36 38,38 35,41 34,42 33,45 32,47 28,50 28,52 32,57 33)', -2,
  'join=mitre'),
 0.2)), 1);
-SELECT 't13', ST_AsEWKT(ST_Normalize(ST_OffsetCurve(
+SELECT 't13', ST_AsEWKT(ST_Normalize(ST_Simplify(ST_OffsetCurve(
  'LINESTRING(0 0,0 20, 10 20, 10 10, 0 10)', 2,
  'join=mitre'
-)));
-/**SELECT 't14', ST_AsEWKT(ST_OffsetCurve(
- 'LINESTRING(0 0,0 20, 10 20, 10 10, 0 10)', -2,
- ''
-));
-SELECT 't15', ST_AsEWKT(ST_OffsetCurve(
- 'GEOMETRYCOLLECTION(LINESTRING(0 0,0 20, 10 20, 10 10, 0 10),MULTILINESTRING((2 0,2 20, 12 20, 12 10, 2 10),(3 0,3 20, 13 20, 13 10, 3 10)))', -2,
- ''
-));**/
+), 0)));
+-- SELECT 't14', ST_AsEWKT(ST_Normalize(ST_OffsetCurve(
+--  'LINESTRING(0 0,0 20, 10 20, 10 10, 0 10)', -2,
+--  ''
+-- )));
+-- SELECT 't15', ST_AsEWKT(ST_Normalize(ST_OffsetCurve(
+--  'GEOMETRYCOLLECTION(LINESTRING(0 0,0 20, 10 20, 10 10, 0 10),MULTILINESTRING((2 0,2 20, 12 20, 12 10, 2 10),(3 0,3 20, 13 20, 13 10, 3 10)))', -2,
+--  ''
+-- )));
 select '#2508', ST_IsValid(ST_OffsetCurve(
 	'0102000020BB0B000010000000FBB019D1AD1537414A733C4E5333534167CE8F06B815374151F4926C4D335341C4899405B61537413DB009254A335341513EE234AD1537413689A27947335341E38CCA31AB1537415D00E28E44335341951F7F0BB315374104E4CA2441335341A581F041BF153741D46F9F8A3F33534100C27968CD153741C6CAAFE83F335341493DB10CDA1537418919897142335341FCA312FCE01537415D1A1F8045335341C62D3822DD153741554B118E483353411B98FE61D1153741FC35CEE14A33534106DCFDA5C5153741573BD3584B33534167CE8F06B815374151F4926C4D335341FBB019D1AD1537414A733C4E533353414AEB33644E153741595A854786335341',
 	10
diff --git a/regress/core/offsetcurve_expected b/regress/core/offsetcurve_expected
index c06e01514..c3b00af60 100644
--- a/regress/core/offsetcurve_expected
+++ b/regress/core/offsetcurve_expected
@@ -6,7 +6,7 @@ t3|SRID=42;LINESTRING(0 -10,10 -10)
 t4|SRID=42;LINESTRING(0 10,10 10)
 t5|SRID=42;LINESTRING(0 -10,10 -10,12 -10,14 -9,16 -8,17 -7,18 -6,19 -4,20 -2,20 0,20 10)
 t5b|SRID=42;LINESTRING EMPTY
-t6|SRID=42;LINESTRING(0 -10,10 -10,17 -7,20 0,20 10)
+t6|SRID=42;LINESTRING(0 -10,10 -10,12 -10,14 -9,16 -8,17 -7,18 -6,19 -4,20 -2,20 0,20 10)
 t7|SRID=42;LINESTRING(0 -10,10 -10,20 0,20 10)
 t8|SRID=42;LINESTRING(0 -10,20 -10,20 10)
 t10|SRID=42;LINESTRING(0 2,7 2,3 9)

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

Summary of changes:
 raster/test/cunit/cu_gdal.c       | 175 +++++++++++---------------------------
 regress/core/offsetcurve.sql      |  29 +++----
 regress/core/offsetcurve_expected |   2 +-
 3 files changed, 65 insertions(+), 141 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list