[Community] Intersects problem
Pascal Leroux
pa.leroux at gmail.com
Mon May 11 11:44:32 EEST 2009
Hi Mario,
I use libgeos 3.1 (on Ubuntu and MacOSX)
But I've already got strange/wrong results with shapely when libgeos is
built (configure;make;make install) with g++ version 4.3.
I've rebuilt libgeos with g++ version 4.2 and that works fine (don't know
why).
(see http://lists.gispython.org/pipermail/community/2009-March/001995.html)
Pascal
2009/5/11 Mario Ceresa <mario.ceresa at torrescalla.it>
> Hello Pascal,
> thanks for your prompt response! Now I see why using the polygon or
> its exterior is different: it makes much more sense. Still I confirm
> that all the intersections of both the linear ring and the polygon
> with the points in your example return True. Contains works as
> expected.
>
> I'm wondering whether there is any known bug in the geos library.
> Could you please let me know if you are using the 3.1 too or a
> different version?
>
> Thanks a lot for your help
>
> Mario
>
>
>
> On Thu, May 7, 2009 at 8:42 PM, Pascal Leroux <pa.leroux at gmail.com> wrote:
> > Hi Mario,
> >
> > I'm surprised with your results. That's what I get with Shapely 1.0.12 :
> >
> >>>> from shapely.geometry import Point
> >>>> from shapely.geometry.polygon import LinearRing
> >>>> test = LinearRing(((1,1),(2,3),(4,2),(3,0)))
> >>>> points = [ Point((2,2)),Point((1,0.5)),Point((1.5,0.5)) ]
> >>>> map(test.intersects,points)
> > [False, False, False]
> >>>> map(test.contains,points)
> > [False, False, False]
> >
> > But, don't forget that a LinearRing instance is a 1D object/shape.
> > So your "test" LinearRing is different from a Polygon whose outer ring is
> > "test" :
> >
> > >>> from shapely.geometry import Polygon
> >>>> poly = Polygon(((1,1),(2,3),(4,2),(3,0)))
> >>>> map(poly.intersects,points)
> > [True, False, False]
> >>>> map(poly.contains,points)
> > [True, False, False]
> >
> > Pascal
> >
> > 2009/5/7 Mario Ceresa <mario.ceresa at torrescalla.it>
> >>
> >> Hello everybody,
> >> I'm sorry to ask a very stupid question, but I don't undestand well
> >> how intersects and contains work:
> >>
> >> >> test = LinearRing([(1,1),(2,3),(4,2),(3,0)])
> >> >> points = [Point(2,2),Point(1,0.5),Point(1.5,0.5)]
> >> >> map(test.intersects,points)
> >> returned [True, True, True] and I was expecting [True,False,False]
> >> >> map(test.contains,points)
> >> returned [False, False, False] and I was expected [True,False,False]
> >>
> >> It may be that I'm thinking at the wrong geometry but why (1;0.5) and
> >> (1.5;0.5) are considered intersected with the polygon if they are
> >> outside? Is the intersection done with the bounding box of the
> >> objects?
> >>
> >> Is there any way to retrieve the points contained within the polygon?
> >>
> >> I'm using Shapely-1.0.12-py2.5 and geos 3.1 on a x86_64 Fedora 9
> >>
> >> Thanks and regards,
> >>
> >> Mario
> >> _______________________________________________
> >> Community mailing list
> >> Community at lists.gispython.org
> >> http://lists.gispython.org/mailman/listinfo/community
> >
> >
> > _______________________________________________
> > Community mailing list
> > Community at lists.gispython.org
> > http://lists.gispython.org/mailman/listinfo/community
> >
> >
> _______________________________________________
> Community mailing list
> Community at lists.gispython.org
> http://lists.gispython.org/mailman/listinfo/community
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20090511/fc7c5893/attachment.htm>
More information about the Community
mailing list