[postgis-users] Re: st_dwithin in SRID 4269

Christopher Swingley cswingle at gmail.com
Sat Apr 25 10:52:04 PDT 2009


Sachin,

> 1 degree is 1852 meters, so if i do distance/1852, in the Query1 i
> should get the correct results, but that is not happening.

I'm not sure where that conversion comes from, but it's unlikely to be
true over the entire surface of the earth.  Picture what a polar
projection looks like when you draw latitude and longitude lines on it.
Longitudes converge at the pole, so the physical distance between 1
degree of longitude becomes smaller and smaller.

> So what you suggest is the best way to find whether two geoms are at
> 'dist' distance apart.  Whether the following query will do in all
> cases.
> 
> SELECT * FROM table where st_dwithin(transform(geom1, 2163),
> transform(geom2, 2163), dist);
> 
> Or It will again depend on which SRID i am using?

I'm not an expert, but I believe that what SRID you transform to *will*
make a difference in the distance between them.  If you choose a
projection that's not appropriate for the region you're interested in,
you shouldn't expect distances to be correct.

Cheers,

Chris
-- 
Christopher S. Swingley
http://swingleydev.com/
<cswingle at gmail.com>




More information about the postgis-users mailing list