Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#3886 closed defect (fixed)

ST_Subdivide loses boxes on some inputs

Reported by: komzpa Owned by: pramsey
Priority: medium Milestone: PostGIS 2.4.1
Component: postgis Version: 2.4.x
Keywords: Cc:

Description

There is landmass geometry that ST_Subdivide fails to correctly split. It loses a whole big box, producing a warning:

[local] gis@gis=# select ST_IsValid(geom) from bad_geom;
┌────────────┐
│ st_isvalid │
├────────────┤
│ t          │
└────────────┘
(1 row)

Time: 686,142 ms
[local] gis@gis=# select ST_IsSimple(geom) from bad_geom;
┌─────────────┐
│ st_issimple │
├─────────────┤
│ t           │
└─────────────┘
(1 row)

Time: 37,460 ms
[local] gis@gis=# select ST_Subdivide(geom) from bad_geom limit 1;
NOTICE:  00000: Error performing rectangular clipping: IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
LOCATION:  pg_notice, lwgeom_pg.c:184
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                            st_subdivide                                                                                            │
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 0103000020110F00000100000005000000DB916D3B01A260C100000060C3CE5141000000F00C9F60C100000060C3CE5141000000F00C9F60C1E7B8076F2BC85141F6285CC78CA160C148E17A94BFCD5141DB916D3B01A260C100000060C3CE5141 │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
(1 row)

Time: 2070,714 ms (00:02,071)

Attachments (1)

bad_geom.sqld.gz (1.8 MB ) - added by komzpa 7 years ago.

Download all attachments as: .zip

Change History (8)

by komzpa, 7 years ago

Attachment: bad_geom.sqld.gz added

comment:1 by komzpa, 7 years ago

On ST_Subdivide(geom, 10) it has two such boxes.

comment:2 by komzpa, 7 years ago

I hope that https://github.com/postgis/postgis/pull/154 may be a way to fix.

I don't know how to make a smaller reproducer to put it into regress tests.

comment:3 by komzpa, 7 years ago

Workaround: ST_Subdivide(ST_FilterSmallRings(geom, 1)) using ST_FilterSmallRings from https://github.com/gojuno/lostgis/blob/master/sql/functions/ST_FilterSmallRings.sql

comment:4 by pramsey, 7 years ago

In 15965:

Fix rare missing boxes in geometry subdivision
References #3886

comment:5 by pramsey, 7 years ago

Resolution: fixed
Status: newclosed

In 15966:

Fix rare missing boxes in geometry subdivision
Closes #3886

comment:6 by robe, 7 years ago

@pramsey minor gripe.

You are supposed to put Darafei Praliaskouski in the commit and NEWS credits

comment:7 by strk, 7 years ago

I'm so glad you're around Regina :)

PS: I've instructed other contributors to do this themselves, and it worked nicely. Kompza take note!

Note: See TracTickets for help on using tickets.