spT.geodist: Geodetic/geodesic Distance

View source: R/useful_commands.R

spT.geodistR Documentation

Geodetic/geodesic Distance

Description

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

Usage

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


##

# 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)

##


spTimer documentation built on Sept. 11, 2024, 6:25 p.m.