distance_to_direct_line: Add deviation from shortest route from begin of track to a...

Description Usage Arguments Value Credit Author(s) See Also Examples

View source: R/t_distance_to_direct_line.R

Description

Add deviation from shortest route from begin of track to a line

Usage

1
2
3
4
distance_to_direct_line(
  tracks, line, bind = TRUE, drop = TRUE, cname = "distance_to_direct_line",
  t_id = "id"
)

Arguments

tracks

psyo. Data frame with tracks.

line

list. A list with the column lon (numeric) and lat (numeric).

t_id

character or numeric. Column name in tracks that identifies the separate tracks.

bind

logical. Return the distance as list (FALSE) or add it to tracks (TRUE).

drop

logical. If TRUE and only one observation is returned drop the data frame and collapse the return value to a vector.

cname

character. Column name of the returned calculation result.

Value

psyo. Distance in meter.

Credit

If you use 'psyosphere' for commercial use or research, please support us by include one off the following references:

Author(s)

Benjamin Ziepert. Please send feedback to: feedback-psyosphere@analyse-gps.com.

See Also

distance_line

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: \dontrun{
# Get data
data(psyo_rounds2)

# Create finish line
finish <- data.frame(lon = c(6.851810,6.851000), lat = c(52.241800,52.240300))

# Plot tracks and finish
plot <- plot_tracks(psyo_rounds2, t_id = "")
plot_line(finish, plot = plot)

# Get deviation from shortest rout from begin to finish
psyo_rounds2 <- distance_to_direct_line(psyo_rounds2, finish)
}
## End(Not run)

psyosphere documentation built on July 2, 2020, 12:08 a.m.