>
> 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

I'm away from my computer until July 1, but look at it as soon as I get
back. Can anyone else confirm?

Sean


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

Reply via email to