[postgis-users] ST_Contains(a.coordinates::::geometry, b.coordinates::::geometry)

Sandro Santilli strk at keybit.net
Tue Aug 9 15:33:35 PDT 2011


On Tue, Aug 09, 2011 at 10:28:34PM +0300, Antonio Rodriges wrote:
> Thank you, Sandro,
> 
> yes, I clearly understand this, but all my contours are CLOSED and
> NONE of them intersects each other. many of them contain each other.
> actually, they are like isobars on synoptic map,
> 
> please, see for ex
> http://1.bp.blogspot.com/_a1AVUIK5Er8/S27QJhQijOI/AAAAAAAAI88/NUJE11Me6n4/s1600-h/Synoptic+Chart.jpg

The fact that your lines are CLOSED doesn't make them areas.
None of the following 2 CLOSED lines contain the other:

 +-A------+
 |        |
 | +B--+  |
 | |   |  |
 | +---+  |
 |        |
 +--------+

You may want to convert them to polygons if you want to check that "B"
is contained by "A":

 SELECT ST_Contains(ST_MakePolygon(A), ST_MakePolygon(B));

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html



More information about the postgis-users mailing list