spT.geodist: Geodetic/geodesic Distance

Description Usage Arguments Details See Also Examples

View source: R/useful_commands.R

Description

This geodetic distance provides the distance between the locations in Kilometers (k.m.) and Miles, using spherical law of Cosines.

Usage

1
2
3
4
spT.geodist(Lon, Lat, KM = TRUE)

spT.geo.dist(point1, point2)
spT.geo_dist(points)

Arguments

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.

Details

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.

See Also

NYdata, spT.grid.coords.

Examples

 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)

##

jmarca/spTimer documentation built on May 19, 2019, 1:51 p.m.