Skip to contents

The points whose distance, .distance, satisfies $$dm <= .distance < dM$$ are kept (.exclude = FALSE) or excluded (.exclude = TRUE)

Usage

filter_positions_at_range(
  df,
  geo,
  dm,
  dM,
  lon,
  lat,
  .exclude = FALSE,
  .keep = FALSE
)

Arguments

df

a (trajectory) data frame

geo

a geographical location in lon/lat (WGS84)

dm

a distance in Nautical Miles

dM

a distance in Nautical Miles

lon

the column for longitude in df

lat

the column for latitude in df

.exclude

exclude the point in the (dm, dM) [default is FALSE]

.keep

keep the calculated distance (in Nautical Miles) in the .distance column [default is FALSE]

Value

a subset of df

Examples

if (FALSE) {
fra <- c(8.570556, 50.03333) # Frankfurt Airport (longitude, latitude)

# keep the points 40 NM from FRA
poss %>% filter_positions_at_range(fra, 0, 40, longitude, latitude)
# keep the points from 10 to 40 NM from FRA
poss %>% filter_positions_at_range(fra, 10, 40, longitude, latitude)
# exclude the points from 10 to 40 NM from FRA
poss %>% filter_positions_at_range(fra, 10, 40, longitude, latitude, .exclude = TRUE)
# keep the points further away of 40 NM from FRA
poss %>% filter_positions_at_range(fra, 0, 40, longitude, latitude, .exclude = TRUE)
}