Opened 5 years ago

Closed 5 years ago

#4495 closed defect (fixed)

Incorrect geometry bbox returned from ST_SnapToGrid

Reported by: Algunenano Owned by: Algunenano
Priority: high Milestone: PostGIS 2.3.11
Component: postgis Version: master
Keywords: Cc:

Description

Following the #4493 and #4494 drill:

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
)
Select ST_AsText(g) as geometry, postgis_getbbox(g) AS box from geom;
              geometry              |              box               
------------------------------------+--------------------------------
 POLYGON((0 0,10 0,10 10,0 10,0 0)) | BOX(0 0,10.6000003814697 10.5)
(1 row)

Change History (6)

comment:1 by Algunenano, 5 years ago

By following the /* COMPUTE_BBOX TAINTING */ comment I see this affects LWGEOM_SetEffectiveArea, LWGEOM_ChaikinSmoothing and LWGEOM_snaptogrid, LWGEOM_snaptogrid_pointoff.

The fix is simple, but I'll try to come up with test to along with it for each function.

comment:2 by Algunenano, 5 years ago

After testing it, the only affected functions are LWGEOM_snaptogrid and LWGEOM_snaptogrid_pointoff, since LWGEOM_SetEffectiveArea and LWGEOM_ChaikinSmoothing don't reuse the input and the output doesn't have a bbox (so it's calculated with lwgeom_add_bbox).

I've added tests for all 4 functions and the fix for the 2 affected by the issue in https://github.com/postgis/postgis/pull/473

comment:3 by Raul Marin, 5 years ago

In 17798:

Fix ST_SnapToGrid output having an outdated bbox

References #4495
Closes https://github.com/postgis/postgis/pull/473

comment:4 by Raul Marin, 5 years ago

In 17799:

Fix ST_SnapToGrid output having an outdated bbox

References #4495

comment:5 by Raul Marin, 5 years ago

In 17800:

Fix ST_SnapToGrid output having an outdated bbox

References #4495

comment:6 by Raul Marin, 5 years ago

Resolution: fixed
Status: assignedclosed

In 17801:

Fix ST_SnapToGrid output having an outdated bbox

Closes #4495

Note: See TracTickets for help on using tickets.