Description Usage Arguments Details See Also Examples
View source: R/useful_commands.R
This geodetic distance provides the distance between the locations in Kilometers (k.m.) and Miles, using spherical law of Cosines.
1 2 3 4  | spT.geodist(Lon, Lat, KM = TRUE)
spT.geo.dist(point1, point2)
spT.geo_dist(points)
 | 
Lon | 
 The longitude position.  | 
Lat | 
 The latitude position.  | 
KM | 
 A logical value, if 'TRUE' then output is in ‘kilometers’, otherwise in ‘miles’.  | 
point1 | 
 In the form of (longitude, latitude) position.  | 
point2 | 
 In the form of (longitude, latitude) position.  | 
points | 
 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25  | ##
# 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)
##
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.