Opened 6 years ago

Last modified 3 months ago

#603 new defect

GEOSPreparedIntersects returns true if geom intersects extent of MultiPolygon on Windows XP

Reported by: olt Owned by: strk
Priority: major Milestone: GEOS Fund Me
Component: Core Version: 3.3.0
Severity: Unassigned Keywords:
Cc: olt

Description

I think I found a strange bug. I'm working with prepared geometries (of type MultiPolygon?) and I get false positives on intersection tests, but only on Windows XP.

3.2.3 works fine, but the results are wrong from 3.3.0 to svn-3.3 branch (GitHub mirror) from 20121123.

I compiled all versions on Windows 7 (32bit) with SDK 7.1 (nmake /f makefile.vc) and tested it with the Python code below. The test creates a MultiPolygon? with one Polygon on the left and one on the right and I test for intersection with another polygon in the middle.

I hardcoded the geos.dll in shapely.geos.py to make sure I tested the right version (e.g. _lgeos = CDLL(r"z:\build\geos-3.3.3\geos.dll"))

The test code:

from shapely import geos
print geos._lgeos.GEOSversion()

from shapely.geometry import box, MultiPolygon
from shapely.prepared import prep

print     (MultiPolygon([box(0, 0, 1, 10), box(40, 0, 41, 10)])).intersects(box(20, 0, 21, 10))
print prep(MultiPolygon([box(0, 0, 1, 10), box(40, 0, 41, 10)])).intersects(box(20, 0, 21, 10))

On Windows XP the code returns False/False? with 3.2.3 but False/True? on 3.3.0 and newer. It works fine on Windows 7.

Change History (5)

comment:1 Changed 6 years ago by olt

Unfortunately, it also fails with 3.2.3 when reusing a prepared statement.

The following example returns False and then True on Windows XP with GEOS 3.2.3:

mp = prep(MultiPolygon([box(0, 0, 1, 10), box(40, 0, 41, 10)]))
print mp.intersects(box(20, 0, 21, 10))
print mp.intersects(box(20, 0, 21, 10))

comment:2 Changed 6 years ago by strk

Milestone: 3.3.73.3.x

comment:3 Changed 5 years ago by robe

Have you had a chance to test with 3.3.9 and 3.4.0dev

unfortunately this will be hard to test since I don't have a windows xp readily handy nor do I compile with SDK 7.1.

comment:4 Changed 5 years ago by robe

Milestone: 3.3.9GEOS Future

since there is probably not much we can do about this since it will be difficult for any of us to replicate. Pushhh.

comment:5 Changed 3 months ago by robe

Milestone: GEOS FutureGEOS Fund Me

Milestone renamed

Note: See TracTickets for help on using tickets.