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

Chris Story kc5hhq at gmail.com
Fri Nov 7 05:25:59 PST 2008


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%3Fand
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<http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Frover%2Eebay%2Ecom%2Frover%2F1%2F705%2D10129%2D5668%2D323%2F4%3Fid%3D10&_t=763807330&_r=hotmailTAGLINES&_m=EXT>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081107/457c1a4f/attachment.html>


More information about the postgis-users mailing list