distance_line {psyosphere} | R Documentation |
Add shortest distance to a line
distance_line( tracks, line, bind = TRUE, drop = TRUE, cname = "distances_to_line" )
tracks |
|
line |
list. A list with the column lon (numeric) and lat (numeric). |
bind |
logical. Return the distance as list ( |
drop |
|
cname |
|
psyo
or list
. Distance in meter.
If you use Psyosphere for commercial use or research, please support us by include one off the following references:
Creative Commons: "Psyosphere" by B. Ziepert, E. G. Ufkes & P. W. de Vries from analyse-gps.com / CC-BY-SA-4.0
APA: de Vries, P. W., et al. (2016). "De psychologie van bewegingen GPS-technologie voor de analyse van natuurlijk gedrag." Tijdschrift voor Human Factors 2: 11-15.
Benjamin Ziepert. Please send feedback to: feedback-psyosphere@analyse-gps.com.
distance_peers
, distance_point
, distance_psyo
# Get data data(psyo_rounds) data(psyo_rounds_map) # Set start and finish lon <- c(6.849975, 6.849627, 6.850001, 6.850350, 6.849975) lat <- c(52.241745, 52.241100, 52.241004, 52.241649, 52.241745) polygon_start <- data.frame(lon, lat) remove(lon, lat) lon <- c(6.851810, 6.851000, 6.851489, 6.852296, 6.851810) lat <- c(52.241800, 52.240300, 52.240163, 52.241657, 52.241794) polygon_finish <- data.frame(lon, lat) remove(lon, lat) # Select between start and finish psyo_rounds <- psyosphere::select_between_polygons( psyo_rounds, polygon_start, polygon_finish ) # Finish line finish <- data.frame(lon = c(6.851810,6.851000), lat = c(52.241800,52.240300)) # Plot tracks, selection polygons and finish line plot <- psyosphere::plot_polygon(polygon_start, plot = psyo_rounds_map) # plot <- psyosphere::plot_polygon(polygon_start) plot <- psyosphere::plot_polygon(polygon_finish, plot = plot) plot <- psyosphere::plot_tracks(psyo_rounds, t_id = "", plot = plot) psyosphere::plot_line(finish, plot = plot) # Add distance to line to dataframe psyo_rounds <- psyosphere::distance_line(psyo_rounds,finish, TRUE)