[postgis-users] Amatuer question - Distance between two points

Michael Signup michael.signup at hotmail.com
Fri Nov 7 15:40:41 PST 2008


Neat. Thanks very much Chris.

Michael

Date: Fri, 7 Nov 2008 07:25:59 -0600
From: kc5hhq at gmail.com
To: postgis-users at postgis.refractions.net
Subject: Re: [postgis-users] Amatuer question - Distance between two points

Michael,
  If your SRID is not in UTM, you will need to use the utmzone function to transform it into the correct UTM SRID. This will result in the distance being measured in meters.

Have a look at http://postgis.com/support/wiki/index.php?How%20to%20get%20distance%20measurement%20in%20meters%3F and http://postgis.com/support/wiki/index.php?plpgsqlfunctions

   
This is the query I use. My wkb_geometry is in SRID 4326.
Select distance(transform(wkb_geometry,utmzone(GeomFromText( 'POINT($lon $lat)', 4326 ))),transform(GeomFromText( 'POINT($lon $lat)', 4326 ),utmzone(GeomFromText( 'POINT($lon $lat)', 4326 ))))


On Fri, Nov 7, 2008 at 5:55 AM, Michael Signup <michael.signup at hotmail.com> wrote:












Hi,

This is probably a very simple question but I am unable to find anything to point me in the right direction.

I am trying to understand how I can make distance related queries with PostGIS. To do this, I am attempting to calculate the distance between:


in Lat/Long
Point A(-38.034031,145.201711) and Point B(-37.899854,145.087116)

I have tried several methods and am still getting the distance as 92072.62 (I don't know what units this is in, but I am trying to get it in meters).


Google Earth calculates the distance as 17.4 km (approximately).

Regards,
Michael




Find great deals on eBay Net yourself a bargain


_______________________________________________

postgis-users mailing list

postgis-users at postgis.refractions.net

http://postgis.refractions.net/mailman/listinfo/postgis-users




-- 
Thank you,

Chris Story
Developer
Federal Flood Certification Corporation
4000 Horizon Way
Irving, TX 75063
Phone: (800) 449-3322 ext 15931
FAX: (800) 929-3322

_________________________________________________________________
Time for change? Find your ideal job with SEEK.
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2F%3Ftracking%3Dsk%3Atl%3Ask%3Anine%3A0%3Ahottag%3Achange&_t=757263783&_r=SEEK_tagline&_m=EXT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081108/56e047ef/attachment.html>


More information about the postgis-users mailing list