Code covered by the BSD License  

Highlights from
Compute the Great Circle Distance between two points

Be the first to rate this file! 13 Downloads (last 30 days) File Size: 1.78 KB File ID: #23026

Compute the Great Circle Distance between two points

by Steve Ratts

 

18 Feb 2009

compute the great circle distance between two points given lat and long.

| Watch this File

File Information
Description

This function will compute the great circle distance between two points on a sphere of uniform radius using the Vincenty formula. At minimum, four inputs are required: lat1, long1, lat2, long2. Optionally, a fifth parameter (r) can be specified. If this parameter isn't specified it's assumed to be the mean radius of the earth in km.

INPUTS:
phi_s = latitude of the standpoint (base)
lambda_s = longitude of the standpoint (base)
phi_f = latitude of the forepoint (destination)
lambda_f = longitude of the forepoint (destination)
r = radius of the sphere [units determine units of d]

OUTPUT:
d = great circle distance from standpoint to forepoint

Note that the Vincenty equation requires the latitude and longitude to be specified in radians. This function will accept either radians, DMS or DM. If the input angles are scalar, they are assumed to be radians. If they are structures or they are not scalars, then they are assumed to be either DMS or DM and are converted to radians as needed.

See http://en.wikipedia.org/wiki/Great-circle_distance

MATLAB release MATLAB 7.6 (R2008a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
04 Mar 2010 William Kenney

This function seems to be based on the assumption that a and b, the major and minor radii of the Earth, are the same. This allows a simplification, as can be seen in the wiki linked above, but it is not the full Vincenty.

A full implimentation would require an iterative appproach.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
mapping Steve Ratts 18 Feb 2009 16:47:53
measurement Steve Ratts 18 Feb 2009 16:47:53
mapping ZerO 22 Feb 2009 20:54:35

Contact us at files@mathworks.com