Learn R Programming

climate (version 1.0.5)

spheroid_dist: Distance between two points on a spheroid

Description

Calculate the distance between two points on the surface of a spheroid using Vincenty's formula. This function can be used when GIS libraries for calculating distance are not available.

Usage

spheroid_dist(p1, p2)

Value

distance between two locations in kilometers

Arguments

p1

coordinates of the first point in decimal degrees (LON, LAT)

p2

coordinates of the second point in decimal degrees (LON, LAT)

Examples

Run this code
 p1 = c(18.633333, 54.366667) # longitude and latitude for Gdansk
 p2 = c(17.016667, 54.466667) # longitude and latitude for Slupsk
 spheroid_dist(p1, p2)
 

Run the code above in your browser using DataLab