estimate_distance: Estimate distance in kilometers from lat long points

Description Usage Arguments Value Author(s) Examples

View source: R/estimate_distance.R

Description

Estimate the distance in kilometers from one point to a set of points in decimal long-lat coordinates.

Usage

1
estimate_distance(x, y, df.x, df.y)

Arguments

x

Longitude coordinates in decimal degrees for the reference point.

y

Latitude coordinates in decimal degrees for the reference point.

df.x

Vector with the longitude coordinates in decimal degrees. Should have the same length as df.y.

df.y

Vector with the latitude coordinates in decimal degrees. Should have the same length as df.x.

Value

A vector of the same length than df.x and df.y, with the distances in kilometers between points.

Author(s)

Ricardo Ochoa Sosa

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
my.data <-
read.table(header = TRUE, text = "
x	y	variable
-99.495	19.16	1
-99.490	19.16	5
-99.500	19.14	2
-99.490	19.15	10
")
#
estimate_distance(x = -99.490,
                  y = 19.16,
                  df.x = my.data$x,
                  df.y = my.data$y)

ricardoochoa/urban.context documentation built on May 27, 2019, 7:41 a.m.