Last chance! 50% off unlimited learning
Sale ends in
This geodetic distance provides the distance between the locations in Kilometers (k.m.) and Miles, using spherical law of Cosines.
spT.geodist(Lon, Lat, KM = TRUE)spT.geo.dist(point1, point2)
spT.geo_dist(points)
The longitude position.
The latitude position.
A logical value, if 'TRUE' then output is in `kilometers', otherwise in `miles'.
In the form of (longitude, latitude) position.
In the form of (longitude, latitude) position.
In the form of points 1:(longitude, latitude) 2:(longitude, latitude) positions.
spT.geodist
is used to get geodetic distance in both miles and kilometers.
spT.geo.dist
is only used to get geodetic distance in kilometers with a different format.
spT.geo_dist
is only used to get geodetic distance in kilometers with a different format.
# NOT RUN {
##
# Load 28 ozone monitoring locations of New York.
data(NYdata)
head(NYdata)
NYsite<-unique(NYdata[,1:3])
# Find the geodetic distance in km
spT.geodist(Lon=NYsite$Longitude, Lat=NYsite$Latitude, KM=TRUE)
# Find the geodetic distance in miles
spT.geodist(Lon=NYsite$Longitude, Lat=NYsite$Latitude, KM=FALSE)
##
# using spT.geo.dist
point1<-c(-73.757,42.681)
point2<-c(-73.881,40.866)
spT.geo.dist(point1,point2)
# using spT.geo_dist
points<-c(point1,point2)
spT.geo_dist(points)
##
# }
Run the code above in your browser using DataLab