GeoDistance
GeoDistance[{lat1,lon1},{lat2,lon2}]
gives the geodesic distance between latitude-longitude positions on the Earth.
GeoDistance[loc1,loc2]
gives the distance between locations specified by position objects or geographical entities.
GeoDistance[{loc1,…,locn}]
gives the total distance from loc1 to locn through all the intermediate loci.
Details and Options

- GeoDistance[loc1,loc2] gives the distance between locations loc1 and loc2 as measured along the geodesic joining them on the surface of the reference ellipsoid. Heights are ignored.
- The result is returned as a Quantity object with dimensions of length. The unit used can be chosen with the option UnitSystem, which has $UnitSystem as default value.
- Latitudes and longitudes can be given as numbers in degrees, as DMS strings, or as Quantity angles.
- Position objects in GeoDistance[loc1,loc2] can be given as GeoPosition, GeoPositionXYZ, GeoPositionENU, or GeoGridPosition objects.
- In GeoDistance[loc1,loc2], the loci can be Entity objects with domains such as "City", "Country", and "AdministrativeDivision".
- For entities corresponding to extended geographic regions, GeoDistance by default computes the minimum distance between any points in the regions.
- GeoDistance[loc1,loc2] by default uses the reference ellipsoid associated with the datum for loc1.
- GeoDistance automatically threads over lists of locations or GeoPosition arrays, so that GeoDistance[loc,locs] returns a list of distances, and GeoDistance[locs1,locs2] returns a matrix of distances. Results are given as QuantityArray objects.
- GeoDistance and GeoDirection, or their combination in GeoDisplacement, solve the geodetic inverse problem.
- GeoDistance has option DistanceFunction, with the following settings:
-
"Boundary" minimum distance between any points in regions "Center" distance between centers of regions "SignedBoundary" distance to boundary, negative for interior points - GeoDistance by default uses the setting DistanceFunction"Boundary".
Examples
open allclose allBasic Examples (5)
Scope (8)
Distance between any two points on the Earth, using the parameters of the default datum "ITRF00":
Angles can also be specified as DMS strings:
Or as Quantity objects:
Compute the distance between Entity objects:
Or between an Entity object and a geo position:
Distance between geodetic positions, in different formats:
Compute distances from a common location to a list of positions, in any format:
Normalize the resulting QuantityArray object:
Compute a matrix of distances between two lists of locations:
Computing all individual distances separately is slower:
Height and time information is ignored in GeoDistance computations:
Points in different datums. The datum of the second point is changed to the datum of the first:
Options (2)
DistanceFunction (1)
UnitSystem (1)
The default unit of the result is determined by the value of $UnitSystem:
Applications (1)
Properties & Relations (10)
GeoDistance is a symmetric function:
GeoDistance is a partial inverse of GeoDestination:
GeoDistance returns part of the result returned by GeoDisplacement for point-like locations:
The length of a degree of parallel strongly depends on latitude:
But the length of a degree of meridian is approximately constant:
The distance corresponding to a given meridian angle α increases when approaching the poles:
Compute distances between consecutive pairs in a list of points with GeoDistanceList:
The same result can be obtained using Partition and GeoDistance, though in a less efficient way:
Include the distance between the last and first point:
GeoDistance computes distances between points:
GeoLength computes the length of a geo path:
Construct points on a geodesic circle, starting with regular bearings:
On an ellipsoid, they are not exactly equidistant:
Construct multiple points along a geodesic, at regular distance intervals:
The list of distances can also be obtained with GeoDistanceList:
The distance between two locations coincides with the distance between their antipodal locations:
Text
Wolfram Research (2008), GeoDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/GeoDistance.html (updated 2016).
CMS
Wolfram Language. 2008. "GeoDistance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/GeoDistance.html.
APA
Wolfram Language. (2008). GeoDistance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GeoDistance.html