Opened 15 years ago

Closed 15 years ago

#253 closed defect (invalid)

Unexpected "Self-intersection at or near point"

Reported by: wvereeck Owned by: geos-devel@…
Priority: minor Milestone: 3.1.1
Component: Core Version: 3.1.0
Severity: Unassigned Keywords: self-intersection
Cc:

Description (last modified by mloskot)

Hi All,

I'm very new to GEOS (< 1 day), but I'm puzzled by what I think is a strange bug.

Being particularly interested in the GEOSUnionCascaded() function to merge large sets (>50,000) of overlapping polygons, altering my dataset manually to avoid this bug(?) is not an option.

I have narrowed down the problem to the following multipolygon, which represents a rectangle inside an octagon (see http://homes.esat.kuleuven.be/~wvereeck/rect_inside_oct.png)

MULTIPOLYGON(((12.26 18.46, 11.76 18.46, 11.54 18.24, 11.54 17.34, 11.76 17.12, 12.26 17.12, 12.48 17.34, 12.48 18.24, 12.26 18.46)),((12.37 18.35, 11.65 18.35, 11.65 17.23, 12.37 17.23, 12.37 18.35)))

I am using the c-interface. Running the GEOSisValid() test on this polygon set results in:

   NOTICE: Self-intersection at or near point 12.37 18.35

Also, GEOSUnionCascaded() accordingly fails with:

   ERROR: TopologyException: found non-noded intersection between 11.65

etc.

However, when I slightly offset the x-position (+1e-8) of the two top vertices of the rectangle, everything works like a charm (i.e. GEOSisValid returns 'true' and GEOSUnionCascaded produces the correct output polygon):

MULTIPOLYGON(((12.26 18.46, 11.76 18.46, 11.54 18.24, 11.54 17.34, 11.76 17.12, 12.26 17.12, 12.48 17.34, 12.48 18.24, 12.26 18.46)), ((12.37000001 18.35, 11.65000001 18.35, 11.65 17.23, 12.37 17.23, 12.37000001 18.35)))

I apologize if I'm too much in a hurry here and should start to learn more about geos before submitting a complaint :) At least I hope this is the right place for this problem.

Kind Regards, Wim Vereecken

FWIW, I'm using geos-3.1.0.tar.bz2 (2009/03/17), libgeos-3.1.0 and Ubuntu 8.04.2 (x86-64) with a 2.6.24-23-generic kernel.

Change History (2)

comment:1 by mloskot, 15 years ago

Description: modified (diff)

comment:2 by pramsey, 15 years ago

Resolution: invalid
Status: newclosed

Invalid inputs don't generally produce correct results. A self-intersecting polygon ring is invalid. When you fix it, you make it valid. We need a way to automate that fixing. See #254.

Note: See TracTickets for help on using tickets.