[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-334-gb3c7347e1

git at osgeo.org git at osgeo.org
Wed Nov 9 22:02:59 PST 2022


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  b3c7347e12e12447b03e37f9cfaab69ee5ecbe36 (commit)
       via  b4b69325eb60f2e324364571d4fb6a21931180c3 (commit)
      from  e09c09524193c8b5fb1e5e00ac73865677adbb7c (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 b3c7347e12e12447b03e37f9cfaab69ee5ecbe36
Merge: e09c09524 b4b69325e
Author: Regina Obe <lr at pcorp.us>
Date:   Thu Nov 10 01:02:48 2022 -0500

    Merge branch 'rasterize_line'


commit b4b69325eb60f2e324364571d4fb6a21931180c3
Author: Regina Obe <lr at pcorp.us>
Date:   Thu Nov 10 01:00:34 2022 -0500

    Fix bad rasterization of linestring (Gilles Vuidel)
    References #5084  for PostGIS 3.4.0

diff --git a/raster/rt_core/rt_raster.c b/raster/rt_core/rt_raster.c
index b5c7956e4..38a821d39 100644
--- a/raster/rt_core/rt_raster.c
+++ b/raster/rt_core/rt_raster.c
@@ -2824,129 +2824,29 @@ rt_raster_gdal_rasterize(
 		_dim[0] == 0 &&
 		_dim[1] == 0
 	) {
-		int result;
-		LWPOLY *epoly = NULL;
-		LWGEOM *lwgeom = NULL;
-		GEOSGeometry *egeom = NULL;
-		GEOSGeometry *geom = NULL;
-
-		RASTER_DEBUG(3, "Testing geometry is properly contained by extent");
-
-		/*
-			see if geometry is properly contained by extent
-			all parts of geometry lies within extent
-		*/
-
-		/* initialize GEOS */
-		initGEOS(rtinfo, lwgeom_geos_error);
-
-		/* convert envelope to geometry */
-		RASTER_DEBUG(4, "Converting envelope to geometry");
-		epoly = rt_util_envelope_to_lwpoly(extent);
-		if (epoly == NULL) {
-			rterror("rt_raster_gdal_rasterize: Could not create envelope's geometry to test if geometry is properly contained by extent");
-
-			OGR_G_DestroyGeometry(src_geom);
-			_rti_rasterize_arg_destroy(arg);
-			/* OGRCleanupAll(); */
-
-			return NULL;
-		}
-
-		egeom = (GEOSGeometry *) LWGEOM2GEOS(lwpoly_as_lwgeom(epoly), 0);
-		lwpoly_free(epoly);
-
-		/* convert WKB to geometry */
-		RASTER_DEBUG(4, "Converting WKB to geometry");
-		lwgeom = lwgeom_from_wkb(wkb, wkb_len, LW_PARSER_CHECK_NONE);
-		geom = (GEOSGeometry *) LWGEOM2GEOS(lwgeom, 0);
-		lwgeom_free(lwgeom);
-
-		result = GEOSRelatePattern(egeom, geom, "T**FF*FF*");
-		GEOSGeom_destroy(geom);
-		GEOSGeom_destroy(egeom);
-
-		if (result == 2) {
-			rterror("rt_raster_gdal_rasterize: Could not test if geometry is properly contained by extent for geometry within extent");
-
-			OGR_G_DestroyGeometry(src_geom);
-			_rti_rasterize_arg_destroy(arg);
-			/* OGRCleanupAll(); */
-
-			return NULL;
-		}
-
-		/* geometry NOT properly contained by extent */
-		if (!result) {
 
 #if POSTGIS_GDAL_VERSION > 18
 
-			/* check alignment flag: grid_xw */
-			if (
-				(NULL == ul_xw && NULL == ul_yw) &&
-				(NULL != grid_xw && NULL != grid_yw) &&
-				FLT_NEQ(*grid_xw, extent.MinX)
-			) {
-				/* do nothing */
-				RASTER_DEBUG(3, "Skipping extent adjustment on X-axis due to upcoming alignment");
-			}
-			else {
-				RASTER_DEBUG(3, "Adjusting extent for GDAL > 1.8 by half the scale on X-axis");
-				extent.MinX -= (_scale[0] / 2.);
-				extent.MaxX += (_scale[0] / 2.);
-			}
+		RASTER_DEBUG(3, "Adjusting extent for GDAL > 1.8 by half the scale on X-axis");
+		extent.MinX -= (_scale[0] / 2.);
+		extent.MaxX += (_scale[0] / 2.);
 
-			/* check alignment flag: grid_yw */
-			if (
-				(NULL == ul_xw && NULL == ul_yw) &&
-				(NULL != grid_xw && NULL != grid_yw) &&
-				FLT_NEQ(*grid_yw, extent.MaxY)
-			) {
-				/* do nothing */
-				RASTER_DEBUG(3, "Skipping extent adjustment on Y-axis due to upcoming alignment");
-			}
-			else {
-				RASTER_DEBUG(3, "Adjusting extent for GDAL > 1.8 by half the scale on Y-axis");
-				extent.MinY -= (_scale[1] / 2.);
-				extent.MaxY += (_scale[1] / 2.);
-			}
+		RASTER_DEBUG(3, "Adjusting extent for GDAL > 1.8 by half the scale on Y-axis");
+		extent.MinY -= (_scale[1] / 2.);
+		extent.MaxY += (_scale[1] / 2.);
 
 #else
 
-			/* check alignment flag: grid_xw */
-			if (
-				(NULL == ul_xw && NULL == ul_yw) &&
-				(NULL != grid_xw && NULL != grid_yw) &&
-				FLT_NEQ(*grid_xw, extent.MinX)
-			) {
-				/* do nothing */
-				RASTER_DEBUG(3, "Skipping extent adjustment on X-axis due to upcoming alignment");
-			}
-			else {
-				RASTER_DEBUG(3, "Adjusting extent for GDAL <= 1.8 by the scale on X-axis");
-				extent.MinX -= _scale[0];
-				extent.MaxX += _scale[0];
-			}
-
+		RASTER_DEBUG(3, "Adjusting extent for GDAL <= 1.8 by the scale on X-axis");
+		extent.MinX -= _scale[0];
+		extent.MaxX += _scale[0];
 
-			/* check alignment flag: grid_yw */
-			if (
-				(NULL == ul_xw && NULL == ul_yw) &&
-				(NULL != grid_xw && NULL != grid_yw) &&
-				FLT_NEQ(*grid_yw, extent.MaxY)
-			) {
-				/* do nothing */
-				RASTER_DEBUG(3, "Skipping extent adjustment on Y-axis due to upcoming alignment");
-			}
-			else {
-				RASTER_DEBUG(3, "Adjusting extent for GDAL <= 1.8 by the scale on Y-axis");
-				extent.MinY -= _scale[1];
-				extent.MaxY += _scale[1];
-			}
+		RASTER_DEBUG(3, "Adjusting extent for GDAL <= 1.8 by the scale on Y-axis");
+		extent.MinY -= _scale[1];
+		extent.MaxY += _scale[1];
 
 #endif
 
-		}
 
 		RASTER_DEBUGF(3, "Adjusted extent: %f, %f, %f, %f",
 			extent.MinX, extent.MinY, extent.MaxX, extent.MaxY);
diff --git a/raster/test/regress/rt_asraster.sql b/raster/test/regress/rt_asraster.sql
index 88c58f091..6a25fd448 100644
--- a/raster/test/regress/rt_asraster.sql
+++ b/raster/test/regress/rt_asraster.sql
@@ -499,6 +499,9 @@ FROM (
 	ORDER BY d.rid
 ) foo;
 
+SELECT '#5084' As ticket, count(dp.geom)
+FROM ST_DumpAsPolygons(ST_AsRaster('LINESTRING(986015.7 6720291.2,986024.3 6720347,986028 6720417.4,986025.6 6720474.3)'::geometry, 2::double precision, 2, 0, 0)) AS dp;
+
 DELETE FROM "spatial_ref_sys" WHERE srid = 992163;
 DELETE FROM "spatial_ref_sys" WHERE srid = 993309;
 DELETE FROM "spatial_ref_sys" WHERE srid = 993310;
diff --git a/raster/test/regress/rt_asraster_expected b/raster/test/regress/rt_asraster_expected
index 79b1cd977..1e8fef17d 100644
--- a/raster/test/regress/rt_asraster_expected
+++ b/raster/test/regress/rt_asraster_expected
@@ -62,3 +62,4 @@ NOTICE:  The rasters have different scales on the X axis
 4.7|992163|150|117|1|1000.000|-1000.000|0.000|0.000|-1898000.000|-412000.000|16BUI|0.000|t|13.000|13.000|t
 4.8|993310|142|88|1|1000.000|-1000.000|0.000|0.000|-176000.000|115000.000|16BUI|0.000|t|13.000|13.000|f
 4.9|993310|142|88|1|1000.000|-1000.000|0.000|0.000|-176453.000|115987.000|16BUI|0.000|t|13.000|13.000|f
+#5084|10

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

Summary of changes:
 raster/rt_core/rt_raster.c               | 124 +++----------------------------
 raster/test/regress/rt_asraster.sql      |   3 +
 raster/test/regress/rt_asraster_expected |   1 +
 3 files changed, 16 insertions(+), 112 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list