- #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 3.0.0alpha4
2019/08/10
/* 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));
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));
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
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)
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;
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)
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;
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)