[postgis-users] Problem with ST_Within, Polygons and Multipolygons

Kevin Neufeld kneufeld at refractions.net
Tue May 5 09:23:22 PDT 2009


A MULTIPOLYGON is just a collection of POLYGONs.  If a point lies on the surface (not in a hole) of any of the polygons, 
contains or within will return true.

If you're sure your multipolygon A does indeed have a hole exactly where your multipolygon B is, then contains or within 
should just return B.

If your forest polygon (A, right?) is not too large, can you post the WKT of the polygon and your query point here?

Cheers,
Kevin

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
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list