[postgis-tickets] r17799 - Fix ST_SnapToGrid output having an outdated bbox
Raul
raul at rmr.ninja
Mon Sep 2 05:09:59 PDT 2019
Author: algunenano
Date: 2019-09-02 05:09:59 -0700 (Mon, 02 Sep 2019)
New Revision: 17799
Modified:
branches/2.5/NEWS
branches/2.5/postgis/lwgeom_functions_analytic.c
branches/2.5/regress/chaikin.sql
branches/2.5/regress/chaikin_expected
branches/2.5/regress/simplifyvw.sql
branches/2.5/regress/simplifyvw_expected
branches/2.5/regress/snaptogrid.sql
branches/2.5/regress/snaptogrid_expected
Log:
Fix ST_SnapToGrid output having an outdated bbox
References #4495
Modified: branches/2.5/NEWS
===================================================================
--- branches/2.5/NEWS 2019-09-02 11:55:46 UTC (rev 17798)
+++ branches/2.5/NEWS 2019-09-02 12:09:59 UTC (rev 17799)
@@ -9,6 +9,7 @@
- #4492, Fix ST_Simplify ignoring the value of the 3rd parameter (Raúl Marín)
- #4494, Fix ST_Simplify output having an outdated bbox (Raúl Marín)
- #4493, Fix ST_RemoveRepeatedPoints output having an outdated bbox (Raúl Marín)
+ - #4495, Fix ST_SnapToGrid output having an outdated bbox (Raúl Marín)
PostGIS 2.5.3
2019/08/11
Modified: branches/2.5/postgis/lwgeom_functions_analytic.c
===================================================================
--- branches/2.5/postgis/lwgeom_functions_analytic.c 2019-09-02 11:55:46 UTC (rev 17798)
+++ branches/2.5/postgis/lwgeom_functions_analytic.c 2019-09-02 12:09:59 UTC (rev 17799)
@@ -331,9 +331,8 @@
/* COMPUTE_BBOX TAINTING */
if ( in_lwgeom->bbox )
- lwgeom_add_bbox(out_lwgeom);
+ lwgeom_refresh_bbox(out_lwgeom);
-
POSTGIS_DEBUGF(3, "SnapToGrid made a %s", lwtype_name(out_lwgeom->type));
out_geom = geometry_serialize(out_lwgeom);
@@ -413,7 +412,10 @@
if ( out_lwgeom == NULL ) PG_RETURN_NULL();
/* COMPUTE_BBOX TAINTING */
- if ( in_lwgeom->bbox ) lwgeom_add_bbox(out_lwgeom);
+ if (in_lwgeom->bbox)
+ {
+ lwgeom_refresh_bbox(out_lwgeom);
+ }
POSTGIS_DEBUGF(3, "SnapToGrid made a %s", lwtype_name(out_lwgeom->type));
Modified: branches/2.5/regress/chaikin.sql
===================================================================
--- branches/2.5/regress/chaikin.sql 2019-09-02 11:55:46 UTC (rev 17798)
+++ branches/2.5/regress/chaikin.sql 2019-09-02 12:09:59 UTC (rev 17799)
@@ -4,3 +4,10 @@
SELECT '4', ST_astext(ST_ChaikinSmoothing('LINESTRING(0 0, 8 8, 0 16)',2));
SELECT '5', ST_astext(ST_ChaikinSmoothing('POINT(0 0)'));
SELECT '6', ST_astext(ST_ChaikinSmoothing('GEOMETRYCOLLECTION(POINT(1 1), LINESTRING(1 1, 1 3, 1 5), POLYGON((5 5, 5 10, 10 10, 10 5, 5 5), (6 6, 6 7, 7 7, 7 6, 6 6 )))', 2, 't'));
+
+-- The geometry bbox is updated
+WITH geom AS
+(
+ SELECT ST_ChaikinSmoothing('POLYGON((0 0, 8 8, 0 16, 0 0))') AS g
+)
+SELECT '7', ST_AsText(g) as geometry, postgis_getbbox(g) AS box from geom;
\ No newline at end of file
Modified: branches/2.5/regress/chaikin_expected
===================================================================
--- branches/2.5/regress/chaikin_expected 2019-09-02 11:55:46 UTC (rev 17798)
+++ branches/2.5/regress/chaikin_expected 2019-09-02 12:09:59 UTC (rev 17799)
@@ -4,3 +4,4 @@
4|LINESTRING(0 0,4.5 4.5,6 7,6 9,4.5 11.5,0 16)
5|POINT(0 0)
6|GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(1 1,1 2.125,1 2.75,1 3.25,1 3.875,1 5),POLYGON((5 5,5 7.8125,5.3125 9.0625,5.9375 9.6875,6.875 10,8.125 10,9.0625 9.6875,9.6875 9.0625,10 8.125,10 6.875,9.6875 5.9375,9.0625 5.3125,7.8125 5,5 5),(6 6,6 6.5625,6.0625 6.8125,6.1875 6.9375,6.375 7,6.625 7,6.8125 6.9375,6.9375 6.8125,7 6.625,7 6.375,6.9375 6.1875,6.8125 6.0625,6.5625 6,6 6)))
+7|POLYGON((2 2,6 6,6 10,2 14,0 12,0 4,2 2))|BOX(0 2,6 14)
Modified: branches/2.5/regress/simplifyvw.sql
===================================================================
--- branches/2.5/regress/simplifyvw.sql 2019-09-02 11:55:46 UTC (rev 17798)
+++ branches/2.5/regress/simplifyvw.sql 2019-09-02 12:09:59 UTC (rev 17799)
@@ -12,3 +12,10 @@
SELECT '10', ST_astext(ST_Simplifyvw('LINESTRING(0 0, 0 10)', 20));
SELECT '11', ST_astext(ST_Simplifyvw('MULTIPOLYGON(((100 100, 100 130, 130 130, 130 100, 100 100)), ((0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 5 6, 6 6, 8 5, 5 5)) )', 20));
SELECT '12', ST_astext(ST_Simplifyvw('MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 5 6, 6 6, 8 5, 5 5)),((100 100, 100 130, 130 130, 130 100, 100 100)))', 200));
+
+-- The geometry bbox is updated
+WITH geom AS
+(
+ SELECT ST_Simplifyvw('MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 5 6, 6 6, 8 5, 5 5)),((100 100, 100 130, 130 130, 130 131, 130 130, 130 100, 100 100)))', 200) AS g
+)
+SELECT '13', ST_AsText(g) as geometry, postgis_getbbox(g) AS box from geom;
Modified: branches/2.5/regress/simplifyvw_expected
===================================================================
--- branches/2.5/regress/simplifyvw_expected 2019-09-02 11:55:46 UTC (rev 17798)
+++ branches/2.5/regress/simplifyvw_expected 2019-09-02 12:09:59 UTC (rev 17799)
@@ -10,3 +10,4 @@
10|LINESTRING(0 0,0 10)
11|MULTIPOLYGON(((100 100,100 130,130 130,130 100,100 100)),((0 0,10 0,10 10,0 10,0 0)))
12|MULTIPOLYGON(((0 0,10 10,0 10,0 0)),((100 100,100 130,130 130,130 100,100 100)))
+13|MULTIPOLYGON(((0 0,10 10,0 10,0 0)),((100 100,100 130,130 130,130 100,100 100)))|BOX(0 0,130 130)
Modified: branches/2.5/regress/snaptogrid.sql
===================================================================
--- branches/2.5/regress/snaptogrid.sql 2019-09-02 11:55:46 UTC (rev 17798)
+++ branches/2.5/regress/snaptogrid.sql 2019-09-02 12:09:59 UTC (rev 17799)
@@ -10,3 +10,12 @@
SELECT ST_snaptogrid(orig, 0.003) ~= ST_snaptogrid(ST_snaptogrid(orig, 0.003), 0.003) FROM tmp;
SELECT ST_snaptogrid(orig, 0.0002) ~= ST_snaptogrid(ST_snaptogrid(orig, 0.0002), 0.0002) FROM tmp;
DROP TABLE tmp;
+
+-- The geometry bbox is updated
+WITH geom AS
+(
+ SELECT ST_SnapToGrid('POLYGON((0 0, 10 0, 10 10, 10.6 10, 10.5 10.5, 10 10, 0 10, 0 0))', 10) as g
+ UNION ALL
+ SELECT ST_SnapToGrid('POLYGON((0 0, 10 0, 10 10, 10.6 10, 10.5 10.5, 10 10, 0 10, 0 0))', 'POINT(0 0)', 10, 10, 10, 10) as g
+)
+Select ST_AsText(g) as geometry, postgis_getbbox(g) AS box from geom;
Modified: branches/2.5/regress/snaptogrid_expected
===================================================================
--- branches/2.5/regress/snaptogrid_expected 2019-09-02 11:55:46 UTC (rev 17798)
+++ branches/2.5/regress/snaptogrid_expected 2019-09-02 12:09:59 UTC (rev 17799)
@@ -3,3 +3,5 @@
t
t
t
+POLYGON((0 0,10 0,10 10,0 10,0 0))|BOX(0 0,10 10)
+POLYGON((0 0,10 0,10 10,0 10,0 0))|BOX(0 0,10 10)
More information about the postgis-tickets
mailing list