Opened 15 years ago

Closed 15 years ago

#234 closed defect (fixed)

Intersection Crashes On Multipolygons With Empty Holes

Reported by: slambright Owned by: strk
Priority: minor Milestone: 3.1.1
Component: Core Version: 3.0.3
Severity: Annoyance Keywords: empty, geometry
Cc:

Description

When doing operations to complicated multipolygons, I ran across this. When I had a multipolygon of the form: MULTIPOLYGON (((1.0000000000000000 1.0000000000000000, 1.0000000000000000 5.0000000000000000, 5.0000000000000000 5.0000000000000000, 5.0000000000000000 1.0000000000000000, 1.0000000000000000 1.0000000000000000), EMPTY)) (empty, but existing, holes polygon)

and I tried to intersect it with another polygon, say MULTIPOLYGON (((3.0000000000000000 3.0000000000000000, 3.0000000000000000 4.0000000000000000, 4.0000000000000000 4.0000000000000000, 4.0000000000000000 3.0000000000000000, 3.0000000000000000 3.0000000000000000)))

I get the error: CoordinateArraySequence.cpp:105: virtual const geos::geom::Coordinate& geos::geom::CoordinateArraySequence::getAt(size_t) const: Assertion `pos<vect->size()' failed. Abort

However, if there isn't an empty hole polygon it works fine.

This happens in both geos3.0.0 and geos3.1.0rc2. I'm running SUSE LINUX 10.1 (X86-64).

Attachments (1)

simppoly.cpp (1.5 KB ) - added by slambright 15 years ago.

Download all attachments as: .zip

Change History (5)

by slambright, 15 years ago

Attachment: simppoly.cpp added

comment:1 by mloskot, 15 years ago

Component: DefaultCore
Keywords: empty geometry added
Milestone: 3.1.0
Priority: majorminor
Severity: UnassignedAnnoyance

I've taken the liberty to paste Martin's comment posted on the list:

This is an error in JTS as well. EMPTY components are generally not handled. The whole idea of having empty components seems pretty pointless to me anyway. I suppose the best thing to do is to simply strip them out in geometry operations.

I believe we can leave the ticket open to not to forget in future, but with clear statement that users are advised to strip EMPTY components out from their geometries.

comment:2 by pramsey, 15 years ago

Milestone: 3.1.1

comment:3 by strk, 15 years ago

Owner: changed from geos-devel@… to strk
Status: newassigned

An abort can't be considered an 'annoyance' to me.. It'd crash the database backend, differently from an exception thrown.

comment:4 by strk, 15 years ago

Resolution: fixed
Status: assignedclosed

no need to throw exceptions. crash is fixed. Here are the results:

Mpoly1: MULTIPOLYGON (((1 1, 1 5, 5 5, 5 1, 1 1), EMPTY)) Mpoly2: MULTIPOLYGON (((3 3, 3 4, 4 4, 4 3, 3 3)))

Intersection: POLYGON ((3 3, 3 4, 4 4, 4 3, 3 3))

Note: See TracTickets for help on using tickets.