[postgis-users] ST_Contains vs. ST_Within

Kevin Neufeld kneufeld at refractions.net
Thu Sep 4 19:51:48 PDT 2008


They are indeed inverses.  Are both your geometries valid?  Can you 
provide a test case?

-- Kevin

cyw at dls.net wrote:
> Thanks. But the two behave differently.
>
> I tried both with the same data (see below) , Within returned more 
> records.
>
> select * into dupage  from maj where Contains((select the_geom from 
> city where area_id=21002891), the_geom)
>
> select * into dupage  from maj where Within(the_geom, (select the_geom 
> from city where area_id=21002891) )
>
>
> ----- Original Message ----- From: "Paul Ramsey" 
> <pramsey at cleverelephant.ca>
> To: "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
> Sent: Thursday, September 04, 2008 5:59 PM
> Subject: Re: [postgis-users] ST_Contains vs. ST_Within
>
>
>> They in inverses.
>>
>> ST_Contains(A,B) <=> ST_Within(B,A)
>>
>> P.
>>
>> On Thu, Sep 4, 2008 at 3:49 PM,  <cyw at dls.net> wrote:
>>> What are the difeerences between these two functions?
>>> Thanks.
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>>
>> _______________________________________________ q
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>
>
> _______________________________________________
> 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