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

Obe, Regina robe.dnd at cityofboston.gov
Wed Mar 19 04:45:20 PDT 2008


Forgot to mention 2163 - my mention of pretty good may not be as good as
your idea and my "pretty good" definition actually varies depending on
what function I am trying to do.  I guess I should have said "May be
good enough" rather than pretty good.
 
2163 will give you a ball park figure (say within a couple meters of
accuracy) and the further the geometries are away from each other I
think the worse that ballpark figure gets.
 
If you are doing surveying work or launching missiles - 2163 is horrible
and you'll want something like UTM or stateplane (basically a conformal
projection that covers smaller area).  It is all a matter of trade-offs.
 
Hope that helps,
Regina 
 

________________________________

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Obe,
Regina
Sent: Wednesday, March 19, 2008 6:56 AM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] How to get the distance between geometry
inmeters?


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.
 
SELECT road.rd_name, ht.ht_name,
ST_Distance(ST_Transform(roads.the_geom,2163) ,
ST_Transform(hotel.the_geom,2163))  as dist_meters
FROM road, hotel
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 Chang
Sent: Wednesday, March 19, 2008 3:09 AM
To: postgis-users at postgis.refractions.net
Subject: [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. 



-----------------------------------------
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080319/33c0200d/attachment.html>


More information about the postgis-users mailing list