R/distance_m.R

Defines functions distance_m

Documented in distance_m

.packageName<-"argosfilter"

distance_m<-function(lat1, lon1, lat2, lon2)
{
if (lat1==lat2 & lon1==lon2) distance<-0 else {
rlat1=radian(lat1)
rlat2=radian(lat2)
rlon=radian(lon2-lon1)
distance<-60*(180/pi)*acos(sin(rlat1)*sin(rlat2)+cos(rlat1)*cos(rlat2)*cos(rlon))
distance<-distance*1852 #distance is given in m
	}
distance
}

Try the argosfilter package in your browser

Any scripts or data that you put into this service are public.

argosfilter documentation built on Sept. 13, 2022, 5:05 p.m.