]> granicus.if.org Git - postgis/commitdiff
Fix ST_Simplify output having an outdated bbox
authorRaúl Marín Rodríguez <rmrodriguez@carto.com>
Thu, 29 Aug 2019 15:20:41 +0000 (15:20 +0000)
committerRaúl Marín Rodríguez <rmrodriguez@carto.com>
Thu, 29 Aug 2019 15:20:41 +0000 (15:20 +0000)
References #4494

git-svn-id: http://svn.osgeo.org/postgis/branches/2.5@17787 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
postgis/lwgeom_functions_analytic.c
regress/simplify.sql
regress/simplify_expected

diff --git a/NEWS b/NEWS
index e60e54239ceeb0179ac039aac12d483348c55d98..4112a257df7f257c7fd931ff6709ff933be0f55b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,7 +3,11 @@ XXXX/XX/XX
 
  * Bug fixes *
 
+  - #4480, Geography Distance inconsistent with Intersects (Paul Ramsey)
+  - #4481, Improve libprotobuf detection for old systems (Paul Ramsey)
+  - #4475, Avoid reading into empty ptarray (Paul Ramsey)
   - #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)
 
 PostGIS 2.5.3
 2019/08/11
@@ -27,9 +31,6 @@ PostGIS 2.5.3
   - #4459, Fix ST_Subdivide crash on intermediate EMPTY (Darafei Praliaskouski)
   - #4470, ST_GeomFromGeoJSON crash on empty rings (Darafei Praliaskouski)
   - #4420, update path does not exists for address_standardizer extension (Regina Obe)
-  - #4480, Geography Distance inconsistent with Intersects (Paul Ramsey)
-  - #4481, Improve libprotobuf detection for old systems (Paul Ramsey)
-  - #4475, Avoid reading into empty ptarray (Paul Ramsey)
 
 
 PostGIS 2.5.2
index 848dfd72393ebf37ec845c0a2e2ec83a7ea83c67..2ca788e3fcdfa565a6845d4f59a368018907c055 100644 (file)
@@ -85,7 +85,8 @@ Datum LWGEOM_simplify2d(PG_FUNCTION_ARGS)
        if ( ! out ) PG_RETURN_NULL();
 
        /* COMPUTE_BBOX TAINTING */
-       if ( in->bbox ) lwgeom_add_bbox(out);
+       if (in->bbox)
+               lwgeom_refresh_bbox(out);
 
        result = geometry_serialize(out);
        lwgeom_free(out);
index b42cfd64773ea5b1e4673527146d034ce8fa779b..a8a343b363e6c5219804368f2ee9ae47d97c7a55 100644 (file)
@@ -14,4 +14,11 @@ SELECT '11', ST_astext(ST_Simplify('MULTIPOLYGON(((100 100, 100 130, 130 130, 13
 SELECT '12', ST_astext(ST_Simplify('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)))', 20));
 
 SELECT '13', ST_astext(ST_Simplify('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 20, false));
-SELECT '14', ST_astext(ST_Simplify('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 20, true));
\ No newline at end of file
+SELECT '14', ST_astext(ST_Simplify('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 20, true));
+
+-- Updates the geometry bbox
+WITH geom AS
+(
+    SELECT ST_Simplify('POLYGON((0 0, 10 0, 10 10, 10.6 10, 10.5 10.5, 10 10, 0 10, 0 0))', 1) as g
+)
+Select '15', ST_AsText(g) as geometry, postgis_getbbox(g) AS box from geom;
\ No newline at end of file
index df25d47f20262ae8de91ea13b6dfe34fa97b6f57..c2920ecd0456413cc7beb7fe067d4d1af81b8637 100644 (file)
@@ -12,3 +12,4 @@
 12|MULTIPOLYGON(((100 100,100 130,130 130,130 100,100 100)))
 13|
 14|POLYGON((0 0,10 0,10 10,0 0))
+15|POLYGON((0 0,10 0,10.5 10.5,0 10,0 0))|BOX(0 0,10.5 10.5)