[postgis-users] How to get the distance between geometry in meters?

R H enoop at hotmail.com
Wed Mar 19 15:03:28 PDT 2008

```isn't this the same as putting two geom w/ a meter projection into st_distance(), st_distance() still returns a cartesian distance not a distances in meters?  Wouldn't you need to do something like...
transform(st_distance(geom,geom),srid)???

I only ask because I am having a simular problem.  My projections are in a meter projection, but I can't get st_distance() or st_dwithin() to use meters?  any thoughts?

Subject: RE: [postgis-users] How to get the distance between geometry in meters?Date: Wed, 19 Mar 2008 06:56:24 -0400From: robe.dnd at cityofboston.govTo: postgis-users at postgis.refractions.net

You'll need to transform to a meter based projection to do that.  If for example you are in the U.S, SRID 2163 US National Atlas Equal Area works pretty good for measurement.  It is not as accurate as UTM or State Plane, but its pretty good and covers all of US I believe and probably works for some of Canada as well (not sure about non-continental e.g. Hawaii, Alaska).

e.g.

WHERE <some criteria here>

If you are somewhere else and your locations are within that projection, you can use that.  Look at the utmzone function in the wiki that will help you determing the right UTM zone SRID for your data

http://postgis.refractions.net/support/wiki/index.php?plpgsqlfunctions

So you would use something liek
SELECT utmzone(ST_Centroid(the_geom)) as srid

to get the right UTM zone SRID

Hope that helps,
Regina

From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Sinboy ChangSent: Wednesday, March 19, 2008 3:09 AMTo: postgis-users at postgis.refractions.netSubject: [postgis-users] How to get the distance between geometry in meters?

i want to get the distance between geometry,just like road or hotel poi,but ST_Distance() return the result in cartesian dintance.
So how can get the distance() by meters?

The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.

Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080319/1c35d1f7/attachment.html>
```