# latlon_to_km: Calculate distance between two locations In geanders/stormwindmodel: Model Tropical Cyclone Wind Speeds

## Description

This function takes latitudes and longitudes for two locations and calculates the distance (in meters) between the locations using the Haversine method.

## Usage

 `1` ```latlon_to_km(tclat_1, tclon_1, tclat_2, tclon_2, Rearth = 6378.14) ```

## Arguments

 `tclat_1` A numeric vector giving latitude of the first location (degrees) `tclon_1` A numeric vector giving longitude of the first location (degrees). This value should be expressed as a positive value for Western hemisphere longitudes. `tclat_2` A numeric vector giving latitude of the second location (degrees) `tclon_2` A numeric vector giving longitude of the second location (degrees). This value should be expressed as a positive value for Western hemisphere longitudes. `Rearth` Radius of the earth (km). Default is 6378.14 km.

## Details

This function uses the Haversine method with great circle distance to calculate this distance. It is applying the following equations to determine distance (in kilometers) between two latitude-longitude pairs:

hav(γ) = hav(φ1 - φ2) + cos(φ1)*cos(φ2)*hav(L1 - L2)

where:

• φ1: Latitude of first location, in radians

• φ2: Latitude of second location, in radians

• L1: Longitude of first location, in radians

• L2: Longitude of second location, in radians

• hav(γ): The haversine function, hav(γ) = sin^2 (γ / 2)

• Rearth: Radius of the earth, here assumed to be 6378.14 kilometers

• D: Distance between the two locations, in kilometers

## Value

A vector with the distance between the two locations, in kilometers.

geanders/stormwindmodel documentation built on Oct. 15, 2018, 12:06 p.m.