Search Postgresql Archives

Fwd: how to write the sql if i want to find a geometry's d-distance neighbors?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I can't mail it to: postgis-users@xxxxxxxxxxxxxxxxxxxxxxx
so could administrator forword this mail to them? thanks!


From: sunpeng <bluevaley@xxxxxxxxx>
Date: 2010/9/12
Subject: how to write the sql if i want to find a geometry's d-distance neighbors?
To: postgis-users@xxxxxxxxxxxxxxxxxxxxxxx


Hi,
 I've the following table,and has created the index on uid and location;
CREATE TABLE points
(
  location geometry, //assume it's a 2-dimension point
  uid integer
)

Now, I've a point P with uid= 12345, and want to find the neighbors which are within 20, how to write the sql?Is this right?
select st_astext(location)
from points a, points b
where b.rid = 12345 and ST_DWithin(a.the_geom, b.the_geom, 20)

or use st_buffer? which one is more efficient ?

Thanks!





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux