[SCM] PostGIS branch master updated. 3.4.0rc1-882-gf66b215f0

git at osgeo.org git at osgeo.org
Tue Jan 16 16:32:08 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  f66b215f0f3a04b83b6c47e004b264c2a5403269 (commit)
      from  8619e4da76e068c94327613a3196c73911f82b0c (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 f66b215f0f3a04b83b6c47e004b264c2a5403269
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Jan 16 16:32:01 2024 -0800

    Fix huge mistake in generate points update

diff --git a/liblwgeom/lwgeom_geos.c b/liblwgeom/lwgeom_geos.c
index d7aa1cedb..1c662d6e6 100644
--- a/liblwgeom/lwgeom_geos.c
+++ b/liblwgeom/lwgeom_geos.c
@@ -1513,8 +1513,8 @@ lwpoly_to_points(const LWPOLY* lwpoly, uint32_t npoints, int32_t seed)
 		for (j = 0; j < sample_height; j++)
 		{
 			int intersects = 0;
-			double xmin = i * sample_cell_size;
-			double ymin = j * sample_cell_size;
+			double xmin = bbox.xmin + i * sample_cell_size;
+			double ymin = bbox.ymin + j * sample_cell_size;
 			GEOSGeometry *gcell = lwpoly_to_points_makepoly(xmin, ymin, sample_cell_size);
 			intersects = GEOSPreparedIntersects(gprep, gcell);
 			if (intersects == 2)
diff --git a/regress/core/generate_points.sql b/regress/core/generate_points.sql
new file mode 100644
index 000000000..ddb80741b
--- /dev/null
+++ b/regress/core/generate_points.sql
@@ -0,0 +1,12 @@
+-- Check containment and count of generated points
+WITH circle AS (
+	SELECT ST_Point(5000,5000) AS pt,
+	       ST_Buffer(ST_Point(5000,5000),10) AS geom
+),
+pts AS (
+	SELECT (ST_Dump(ST_GeneratePoints(geom, 50))).geom AS geom
+	FROM circle
+)
+SELECT 'generate_points_1', bool_and(ST_Distance(circle.pt, pts.geom) < 10), count(pts.geom)
+FROM circle, pts
+
diff --git a/regress/core/generate_points_expected b/regress/core/generate_points_expected
new file mode 100644
index 000000000..4d584a78e
--- /dev/null
+++ b/regress/core/generate_points_expected
@@ -0,0 +1 @@
+generate_points_1|t|50
diff --git a/regress/core/tests.mk.in b/regress/core/tests.mk.in
index 2e872af78..dca602a6a 100644
--- a/regress/core/tests.mk.in
+++ b/regress/core/tests.mk.in
@@ -44,9 +44,10 @@ TESTS += \
 	$(top_srcdir)/regress/core/forcecurve \
 	$(top_srcdir)/regress/core/flatgeobuf \
 	$(top_srcdir)/regress/core/frechet \
+	$(top_srcdir)/regress/core/generate_points \
 	$(top_srcdir)/regress/core/geography \
 	$(top_srcdir)/regress/core/geometric_median \
-  $(top_srcdir)/regress/core/geos_noop \
+	$(top_srcdir)/regress/core/geos_noop \
 	$(top_srcdir)/regress/core/geos38 \
 	$(top_srcdir)/regress/core/hausdorff \
 	$(top_srcdir)/regress/core/in_flatgeobuf \

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

Summary of changes:
 liblwgeom/lwgeom_geos.c               |  4 ++--
 regress/core/generate_points.sql      | 12 ++++++++++++
 regress/core/generate_points_expected |  1 +
 regress/core/tests.mk.in              |  3 ++-
 4 files changed, 17 insertions(+), 3 deletions(-)
 create mode 100644 regress/core/generate_points.sql
 create mode 100644 regress/core/generate_points_expected


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list