[postgis-users] errors while using st_dwithin

Sandro Santilli strk at keybit.net
Thu Dec 6 06:55:35 PST 2012


On Thu, Dec 06, 2012 at 08:17:23PM +0530, tasneem dewaswala wrote:
> Hello,
> 
> i want to know whether two location's are within 100 meters range of each
> other or not.
> i tried using ST_DWITHIN, but its not giving me appropriate answers.
> 
> my query is "
> 
> select
> st_dwithin(ST_GeomFromText('POINT(19.235308
> 72.977955)',2163),ST_GeomFromText('POINT(56.6647756667
> 12.877464)',2163),100) as "result";
> 
> the result that i get is "t" i.e true, which is logically not correct, the
> answer i should get is false, since two locations are far beyond 100 meters
> range.

Their distance is 70.802 units, whatever your units are:

with inp as (
 select ST_GeomFromText('POINT(19.235308 72.977955)',2163) as a,
 ST_GeomFromText('POINT(56.6647756667 12.877464)',2163) as b
)
select ST_Distance(a,b) from inp;

 -> 70.8027829131993

--strk;


More information about the postgis-users mailing list