geodDist(lon1, lat1=NULL, lon2=NULL, lat2=NULL, alongPath=FALSE)section object, from which longitude and latitude are extracted
and used instead of the next three argumentslon1 is a
section object)alongPath=TRUEalongPath=TRUEalongPath=TRUE, any values provided for lat2 and
lon2 will be ignored.The function may be used in several different ways.
Case 1: lon1 is a section object. The values of lat1,
lon2, and lat2 arguments are ignored, and the behaviour
depends on the value of the alongPath argument. If
alongPath=FALSE, the return value contains the geodetic distances of
each station from the first one. If alongPath=TRUE, the return
value is the geodetic distance along the path connecting the stations, in
the order in which they are stored in the section.
Case 2: lon1 is a vector. If lon2 and lat2 are
not given, then the return value is a vector containing the distances of each
point from the first one, or the distancce along the path connecting
the points, according to the value of alongPath. On the other hand,
if both lon2 and lat2 are specified, then the return result
depends on the length of these arguments. If they are each of length 1,
then they are taken as a reference point, from which the distances to
lon1 and lat1 are calculated (ignoring the value of
alongPath). However, if they are of the same length as lon1
and lat1, then the return value is the distance between
corresponding (lon1,lat1) and (lon2,lat2)
values.
geodXylibrary(oce)
km <- geodDist(100, 45, 100, 46)
data(section)
geodDist(section)
geodDist(section, alongPath=TRUE)Run the code above in your browser using DataLab