<html>
<head>
</head>
<body>Hi Liem<br />
<br />
The && operator is not for checking overlapping geometries, just the bounding boxes. The bounding boxes can overlap even if the geometries doesn't. The operator is used to do a first fast (index-based) filtering before doing the real calculation if geometries are overlapping.<br />
<br />
To find if the geometries are overlapping you can use a lot of different functions. St_contains as mentioned will work, just get the order right of the arguments. If you use ST_Intersects instead you don't have to bother about the order of arguments because if a intersects b also b intersects a. <br />
<br />
If it is a large dataset be sure to have a spatial index on your geometry columns.<br />
<br />
So you query will be something like:<br />
<br />
SELECT f.point_id, s.zip_id<br />
FROM points f, zips s<br />
WHERE ST_Intersects(ST_SetSRID(ST_MakePoint(f.longitude, f.latitude),4326), s.zip_polygon);<br />
<br />
<br />
Hope that helps<br />
Nicklas<br />
<br />
<br />
<br />
<br />
<br />
http://postgis.org/documentation/manual-1.5/ST_Geometry_Overlap.html<br />
<br />
2010-05-10 Edward Mac Gillavry wrote:<br />
<br />
Liem,<br />
><br />
>You may want to check out http://postgis.refractions.net/documentation/manual-1.4/ST_Contains.html for the ST_Contains function. Hope this helps.<br />
><br />
>Kind regards,<br />
><br />
>Edward Mac Gillavry<br />
><br />
><hr />
Date: Mon, 10 May 2010 11:29:27 +0700<br />
>From: liemnguyendl@gmail.com<br />
>To: postgis-users@postgis.refractions.net<br />
>Subject: [postgis-users] using "&&" oprerator<br />
><br />
><br />
>Hi All, i'm a newbie with postgis and probably this is an easy question.<br />
><br />
>As I know "&&" operator which is used for checking 1 geometry is overlap on another or not.<br />
>Could I check 1 point is overlap on 1 polygon by the query bellow ?<br />
>
<pre><br />
><br />
><br />
></pre>Cheers.<br />
>-- <br />
>Liem Nguyen<br />
>Developer<br />
>Axon Active Corp.<br />
>
----------------------------------------------------------------------------<br />
>Direct Line : +84 38 948 4645<br />
>Fax : +84 38 811 3489<br />
>Mobile Phone : +84 168 994 8897<br />
>Skype ID : liemnguyendl2204<br />
>
Email : <a>liem.nguyen@axonactive.net</a> / <a>liemnguyendl@gmail.com</a><br />
>Web Site : <a href="http://axonactive.vn" target="_blank">axonactive.vn</a><br />
>
Address : 87 Thang Long Street,Gate 2 Ward 4,<br />
> Tan Binh District, HCM city, Vietnam.<br />
><br />
>
</body>
</html>