[postgis-users] identfying a nearest point

Daniel Kastl orkney at gmx.de
Fri Apr 24 01:19:59 PDT 2009


Hi,
> This is the SQL I tried with:
>
> select v.*, c.gid 
> from vertices_tmp v, customer_location c 
> where c.gid=1 and 
> st_expand(setsrid(((select the_geom from customer_location where
> gid=1)),4326), 10000000) && setsrid(v.the_geom,4326)
> order by distance(setsrid((select the_geom from customer_location where
> gid=1),4326),setsrid(v.the_geom,4326))
> asc limit 1; 
>
>   
Without having tested this "100000000" looks very suspicious.
This value is in the same projection as your geometry is set: 4326
4326 is in degree, so you could try it with 0.1 for example.

Daniel



More information about the postgis-users mailing list