| From: | sunpeng <bluevaley(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Fwd: how to write the sql if i want to find a geometry's d-distance neighbors? |
| Date: | 2010-09-12 06:39:42 |
| Message-ID: | AANLkTik4b3Zpb2YC57QvwCu7AXuz3ecqavbTxgEWVB=j@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
I can't mail it to: postgis-users(at)postgis(dot)refractions(dot)net
so could administrator forword this mail to them? thanks!
From: sunpeng <bluevaley(at)gmail(dot)com>
Date: 2010/9/12
Subject: how to write the sql if i want to find a geometry's d-distance
neighbors?
To: postgis-users(at)postgis(dot)refractions(dot)net
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!
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nick | 2010-09-12 06:52:19 | Re: Is there a bug in FOR i IN 1..10 LOOP (8.4.4)? |
| Previous Message | Phui Hock | 2010-09-12 06:15:20 | Re: How to inherit search_path from template |