Jaakko Salli wrote:
> Brent Pedersen wrote:
>> On Wed, Jun 25, 2008 at 8:52 AM, Jaakko Salli <[EMAIL PROTECTED]> wrote:
>>> Hi all,
>>>
>>> I have encountered strange problem with Polygon.contains(Point). It
>>> seems it stops functioning correctly after being called 21 times. At
>>> that point, instead of checking if point is inside the polygon, it just
>>> check if it is inside polygon's bounding box.
>>>
>>> Here is code to reproduce the issue (I have tried it with Python 2.5.2
>>> and Shapely SVN trunk):
>>>
>>> from shapely.geometry import Point, Polygon
>>>
>>> # Form a 'L' shaped polygon
>>> points = [(0.0, 0.0),
>>>          (1.0, 0.0),
>>>          (1.0, 1.0),
>>>          (2.0, 1.0),
>>>          (2.0, 2.0),
>>>          (0.0, 2.0),
>>>          (0.0, 0.0)]
>>>
>>> poly = Polygon(points)
>>>
>>> # Create point that should be outside polygon, but
>>> # inside its bounding box
>>> pt_outside_but_inside_bbox = Point(1.5, 0.5)
>>>
>>> # Create point that should be outside polygon,
>>> # even outside its bounding box
>>> pt_outside_even_bbox = Point(2.5, 0.5)
>>>
>>> # At iteration number 22, poly.contains effectively becomes
>>> # poly_bounding_box.contains
>>> for i in range(1,100):
>>>    res1 = poly.contains(pt_outside_but_inside_bbox)
>>>    res2 = poly.contains(pt_outside_even_bbox)
>>>    print '#%i: poly.contains(pt_outside_but_inside_bbox) = %s'%(i, res1)
>>>    print '     poly.contains(pt_outside_even_bbox) = %s'%(res2)
>>>    if res1 != False:
>>>        print "poly.contains failed at try #%i!"%(i)
>>>        break
>>>
>>>
>>> Thanks,
>>>  Jaakko Salli
>>>
>>>
>>> _______________________________________________
>>> Community mailing list
>>> [email protected]
>>> http://lists.gispython.org/mailman/listinfo/community
>>>
>> thankfully, i dont see this with r1117. that scared me.
>> even upped the range to 100K and no problems.
>> fwiw, i'm using geos 3.0.0, not an rc...
> I'm using the geos DLL provided with the Windows installer
> (also using Windows XP SP2, if that matters).
I have now built geos 3.0.0 DLL with msys+MingW32. Seems to have fixed
the issue.

Sorry for bothering :)

Thanks,
  Jaakko

_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community

Reply via email to