<font color="#006600"><font size="2"><font face="courier new,monospace">Thanks. I started using GIST. </font></font></font><div><font color="#006600"><font size="2"><font face="courier new,monospace"><br></font></font></font></div>

<div><font color="#006600"><font size="2"><font face="courier new,monospace">It works. </font></font></font></div><div><font color="#006600"><font size="2"><font face="courier new,monospace"><br></font></font></font></div>

<div><font color="#006600"><font size="2"><font face="courier new,monospace"><br clear="all"></font></font></font>Thanks,<br>Sairam Krishnamurthy<br>+1 612 859 8161<br>
<br><br><div class="gmail_quote">On Thu, May 5, 2011 at 8:39 PM, Ben Madin <span dir="ltr"><<a href="mailto:lists@remoteinformation.com.au">lists@remoteinformation.com.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Sairam,<br>
<div class="im"><br>
On 06/05/2011, at 5:50 AM, Sairam Krishnamurthy wrote:<br>
<br>
> Table structure: lat AS double, lon AS double, spatialPoint AS point.<br>
><br>
> I have a query that uses ST_DWITHIN. I was under the impression that this function will use the gist index on spatialPoint.<br>
><br>
> Index query:<br>
> CREATE INDEX "table_spatial_index" ON "table" USING btree ("spatialPoint");<br>
<br>
</div>St_DWithin does use a bounding box if there are suitable indexes. I'm only using 1.5, so things might be different if you are using 2.0 or < 1.3, but I think if you want to use a GIST index you need to create a GIST index, not a b-tree. I thought - and I stress I'm not an expert on indexes that b-tree was one-dimensional.<br>


<div class="im"><br>
> Select query:<br>
> SELECT lat, lon FROM "table" WHERE ST_DWITHIN("table"."spatialPoint", ST_SetSRID(ST_MakePoint(0.064777,18.420500), 4326), 0.0011);<br>
<br>
<br>
</div>Also, I'd caution against using ST_DWithin and non-projected data systems. you won't actually be seeing a circle, even if you do appear to be close to the equator.<br>
<br>
cheers<br>
<br>
Ben<br>
<div class="im"><br>
<br>
<br>
<br>
<br>
<br>
><br>
> Query plan:<br>
><br>
> EXPLAIN SELECT lat, lon FROM "EVI250m" WHERE ST_DWITHIN("EVI250m"."spatialPoint", ST_SetSRID(ST_MakePoint(0.064777,18.420500), 4326), 0.0011);<br>
><br>
>  QUERY PLAN<br>
><br>
> -------------------------------------------------------------------------------------------------------------------------------------------------------------<br>
> -------------------------------------------------------------------------------------------------------------------------------------------------------------<br>
> ------------<br>
>  Seq Scan on "EVI250m"  (cost=0.00..4757082.00 rows=1 width=16)<br>
>    Filter: (("spatialPoint" && '0103000020E61000000100000005000000000000A0224DB03F000000C05D6B3240000000A0224DB03F00000020EE6B3240000000C050DDB03F00000020EE6<br>
> ) AND _st_dwithin("spatialPoint", '0101000020E61000002A7288B83995B03FCFF753E3A56B3240'::geometry, 0.0011::double precision) AND ('0101000020E61000002A7288B83<br>
> recision)))<br>
> (2 rows)<br>
><br>
><br>
> Any thoughts ?<br>
><br>
><br>
><br>
> Thanks,<br>
> Sairam Krishnamurthy<br>
<br>
</div>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br></div>