Description Usage Arguments Details Author(s) Examples
View source: R/select_between_polygons.R
Select tracks between a start and a finish polygon. Only the data between the polygons will remain. Data that is not between the start and finish polygon will be disregarded. If a track passes multiple times first the start and then the finish will be split up in rounds and new track id's will be created for each round.
1 2 3 | select_between_polygons(
tracks, poly1, poly2, t_id = "id", merge_id = TRUE
)
|
tracks |
|
poly1 |
data frame. A data frame with the columns lon (numeric) and lat (numeric). All coordinates will be selected that start after leaving this polygon and enter polygon_finish. The polygon should be closed, therefore the first and last coordinate must be the same. See also |
poly2 |
data frame. A data frame with the columns lon (numeric) and lat (numeric). All coordinates will be selected that start after leaving |
t_id |
character or numeric. Column name in |
merge_id |
logical. If |
The following image shows a track before selection.
The following image shows a track after selection with 3 rounds.
Benjamin Ziepert. Please send feedback to: feedback-psyosphere@analyse-gps.com.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ## Not run: \dontrun{
# Create polygons
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)
# Get a track
data(psyo_rounds)
# Plot tracks
plot <- plot_tracks(psyo_rounds, zoom = 17, t_id = "")
plot
# Add start and finish polyon
plot <- plot_polygon(polygon_start, plot = plot)
plot_polygon(polygon_finish, plot = plot)
# Select data between polygon
psyo_rounds <- select_between_polygons(
psyo_rounds, polygon_start, polygon_finish
)
# Plot the remaining data
plot <- plot_tracks(psyo_rounds, t_id = "")
plot <- plot_polygon(polygon_start, plot = plot)
plot_polygon(polygon_finish, plot = plot)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.