Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#4956 closed defect (fixed)

ST_Boundary(colllection) -> ERROR: MultiLineString cannot contain MultiLineString element

Reported by: strk Owned by: komzpa
Priority: blocker Milestone: PostGIS 3.2.0
Component: postgis Version: master
Keywords: Cc:

Description

Confusing error from this query:

select ST_Boundary('GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2)),POLYGON((2 2,2 4,4 4,4 2,2 2)))'::geometry);

Note that if the first polygon doesn't have an hole the routine returns an answer. Pretty confusing …

This only happens in 3.2.0dev, as in the 3.1 branch we get a nice and understandable message: ERROR: GEOSBoundary: IllegalArgumentException: Operation not supported by GeometryCollection

Both installs are using GEOS-3.10.0dev

Change History (5)

comment:1 by strk, 3 years ago

Owner: changed from pramsey to komzpa

The problem is that lwgeom_boundary assumes a GEOMETRYCOLLECTION will always only have elements having a LINESTRING as a boundary. This is not the case in the example above (first element has a MULTILINESTRING boundary) and is also not the case when elements of the collections are for example linestrings, example:

# select ST_Boundary('GEOMETRYCOLLECTION(LINESTRING(0 0, 10 0),LINESTRING(20 0,21 0))'::geometry);
ERROR:  MultiLineString cannot contain MultiPoint element

Darafei it was your change in [6316fa32e8e8d027d6cf09f683dabef024450403/git] unleashing this

comment:2 by strk, 3 years ago

Darafei I think this would do: https://gitlab.com/postgis/postgis/-/merge_requests/50

It needs a careful review of memory management and proper tests (unit and regress)

comment:3 by strk, 3 years ago

Priority: mediumblocker

comment:4 by kalenikaliaksandr <kalenik.aliaksandr@…>, 3 years ago

Resolution: fixed
Status: newclosed

In 24d6752/git:

Don't assume boundary of collection is linear

Closes #4956

Still needs a regression test

comment:5 by Darafei Praliaskouski <me@…>, 3 years ago

In e35fbe1/git:

Merge and format lwgeom_boundary tests

Thanks Aliaksandr Kalenik and Sandro Santilli for the work on it.

Closes #4956
Closes #4960
Closes #4961
Closes https://github.com/postgis/postgis/pull/626

Note: See TracTickets for help on using tickets.