<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=016241816-21032006><FONT face=Arial size=2>I'm new to PostGIS
(and postgresql for that point), so I apologize if I'm missing something
fundamental. I've created a GIS table containing a geometry column.
I've also created a spatial index on this column. I'm now attempting to
query the table based on a point. I have 2 different queries
below.</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=016241816-21032006><FONT face=Arial size=2>Query 1) (longitude,
latitude, and bufferInFeet are inputs)</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006> <FONT face=Arial
size=2>geom geometry;</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006> <FONT face=Arial
size=2>geom := Buffer(MakePoint(longitude, latitude),
bufferInFeet/364560.0)</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006> <FONT face=Arial
size=2>SELECT polyattributes, poly</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006> <FONT face=Arial
size=2>FROM polygons</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006> <FONT face=Arial
size=2>WHERE poly && geom</FONT></SPAN></DIV>
<DIV>
<DIV><SPAN class=016241816-21032006><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=016241816-21032006><FONT face=Arial size=2>Query 2) (longitude,
latitude, and bufferInFeet are inputs)</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006> <FONT face=Arial
size=2>geom geometry;</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006> <FONT face=Arial
size=2>geom := Buffer(MakePoint(longitude, latitude),
bufferInFeet/364560.0)</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006> <FONT face=Arial
size=2>SELECT polyattributes, poly</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006> <FONT face=Arial
size=2>FROM polygons</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006> <FONT face=Arial
size=2>WHERE poly && geom AND Intersects(poly, geom)</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=016241816-21032006><FONT face=Arial size=2>These queries return
different results in particular cases that I was testing. My question is
why. I assumed that the "&&" operator that is used with the
spatial index performed some sort of intersects function with the bounding box
(geom in this case). If that is the case, then these queries would be
functionally equivalent. But, in my tests, I found that when I used Query
1, more results were returned than when I used Query 2. Can somebody tell
me why this is?</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=016241816-21032006><FONT face=Arial size=2>Thanks in advance
for any help.</FONT></SPAN></DIV>
<DIV><SPAN class=016241816-21032006><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=016241816-21032006></SPAN><FONT face=Arial
size=2>________________________________</FONT></DIV></DIV>
<DIV align=left><FONT face=Arial size=2>Jeremy Nix</FONT></DIV>
<DIV align=left><FONT face=Arial size=1>Senior Application
Developer</FONT></DIV>
<DIV align=left><FONT face=Arial size=1>Southwest Financial Services,
Ltd.</FONT></DIV>
<DIV align=left><FONT face=Arial size=1><A
href="http://www.sfsltd.com/">http://www.sfsltd.com</A></FONT></DIV>
<DIV align=left> </DIV>
<DIV> </DIV></BODY></HTML>