Dist.WREG: Distance calculation (WREG)

Description Usage Arguments Details Value Examples

View source: R/Dist.WREG.R

Description

Dist.WREG calculates the distance between two points defined by Latitude-Longitude coordinates in decimal degrees.

Usage

1
Dist.WREG(Lat1, Long1, Lat2, Long2, method = 2)

Arguments

Lat1

Latitude of the first point, in decimal degrees.

Long1

Lonigtude of the first point, in decimal degrees.

Lat2

Latitude of the second point, in decimal degrees.

Long2

Longitude of the second point, in deceimal degrees.

method

Idicates which technique to use for distance calculation. See details.

Details

Dist.WREG is capable of using two techniques to calculate intersite distances. method==1 indicates that the "Nautical Mile" approximation should be used. This is the function that is currently employed by WREG v. 1.05. Each arcminute is equal to 1852 meters. method==2 indicates that the Haversine approximation should be used.

Value

Returns the distance between the two sites in miles.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Import some example data
peakFQdir <- paste0(
  file.path(system.file("exampleDirectory", package = "WREG"),
    "pfqImport"))
gisFilePath <- file.path(peakFQdir, "pfqSiteInfo.txt")
importedData <- importPeakFQ(pfqPath = peakFQdir, gisFile = gisFilePath)

# For two sites, compute the inter-site distance
# Use the haversine approximation
intersiteDistance <- Dist.WREG(Lat1 = importedData$BasChars$Lat[1],
  Long1 = importedData$BasChars$Lat[1],
  Lat2 = importedData$BasChars$Lat[2],
  Long2 = importedData$BasChars$Lat[2],
  method = 2)

print(intersiteDistance)

wfarmer-usgs/WREG documentation built on July 24, 2020, 1:28 a.m.