mark_inside_polygon {psyosphere} | R Documentation |
A column will be created that indicates whether a coordinate lies within a polygon or not. See also point.in.polygon
.
mark_inside_polygon( tracks, polygon, bind = TRUE, drop = TRUE, cname = "in_polygon" )
tracks |
|
polygon |
list. A list with the column lon (numeric) and lat (numeric). |
bind |
logical. Return the distance as list ( |
drop |
|
cname |
|
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.
# Create polygon lon <- c(4.92, 4.93, 4.93, 4.92, 4.92) lat <- c(52.311, 52.311, 52.308, 52.308, 52.311) poly <- data.frame(lon, lat) remove(lon, lat) # Get data data(psyo) data(psyo_map) # Plot polygon and data plot <- psyosphere::plot_tracks(psyo, t_id = "", plot = psyo_map) # plot <- psyosphere::plot_tracks(psyo, t_id = "") plot <- psyosphere::plot_polygon(poly, plot = plot) plot # Mark coordinates within plygon psyo <- psyosphere::mark_inside_polygon(psyo, poly) # Plot inside polygon in different color in_poly <- psyo[ psyo[,"in_polygon"] != 0,] in_poly[,"dot_color"] <- "red" psyosphere::plot_tracks(in_poly, plot = plot)