If ST_Contains() is returning both polygons then there's probably something wrong with the forest polygon (it doesn't have a hole, or it has both a polygon that has a hole and another component that *is* the hole, etc).
P On Tue, May 5, 2009 at 9:19 AM, Martin Davis <[email protected]> wrote: > Polygons do not contain their holes. For a point P in a MultiPolygon M > which is inside a hole in one of the component Polygons you should have: > > ST_within(P, M) = false > ST_contains(M, P) = false > > Best to post your WKT and your query to confirm that's the problem. > > Jorge wrote: >> >> Hello, >> >> I have a question. If a multipolygon has inner "holes", are these holes >> part of the multipolygon? I mean, if I want to check if a given point is >> inside of a multipolygon (using "within" or "contains") and this point >> is in the hole, should "within" and "contains" return "true"? >> >> Being more specific, I have a multypolygon that represents a forest, in >> a map. This multipolygon has a hole inside. Then, I have another >> multipolygon that fits exactly into the hole, and represents an airport. >> If I select a point from the airport, this point is inside the second >> multipolygon, of course, but should it be inside the first one too? >> Because my problem is that I have to decide if the point is part of the >> airport or part of the forest, and "within" and "contains" methods >> return both multipolygon, instead of only the second one (the airport). >> >> Maybe is more clear with an image: >> http://www.nebulared.com/tmp_geo/multipolygon.jpg >> >> Thanks in advance! >> >> Regards >> Jorge >> _______________________________________________ >> postgis-users mailing list >> [email protected] >> http://postgis.refractions.net/mailman/listinfo/postgis-users >> >> > > -- > Martin Davis > Senior Technical Architect > Refractions Research, Inc. > (250) 383-3022 > > _______________________________________________ > postgis-users mailing list > [email protected] > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
