plot_flight_horizontal: Plot the recorded positions of a flight on a map.

View source: R/plot.R

plot_flight_horizontalR Documentation

Plot the recorded positions of a flight on a map.

Description

Plot the recorded positions of a flight on a map.

Usage

plot_flight_horizontal(
  poss,
  bbox = NULL,
  buffer = 100,
  legend.position = "none",
  shape = NULL,
  ...
)

Arguments

poss

a dataframe of position reports with (at least) callsign, timestamp (a date-time), altitude (in feet), longitude (in decimal degrees) and latitude (in decimal degrees) columns

bbox

a bounding box in the format c(lowerleftlon, lowerleftlat, upperrightlon, upperrightlat).

buffer

number of nautical miles (NM) around the bounding box (default 40)

legend.position

legend position as per ggplot2 (default "none", i.e. do not show it).

shape

shape of point to plot (default NULL, i.e. do not plot positions, only paths). See shape in geom_point.

...

Extra parameters to pass further on.

Value

a ggplot2 plot object.

See Also

Other plot: plot_cpr_horizontal(), plot_flight_vertical_distance(), plot_flight_vertical_time()

Examples

## Not run: 
library(dplyr)

# define the bounding box of interest
europe <- c(left = 5, bottom = 35, right = 30, top = 52)
plot_flight_horizontal(poss, europe)
plot_flight_horizontal(poss, buffer = 10) # 10km around the values

# from DB to plot
p <- export_flights_at_airport_fr24("2017-09-01T00:00:00Z",
                                    "2017-09-02T00:00:00Z",
                                    "SVG",
                                    5.638, 58.877) %>%
  # NOTE: convert till DB columns are properly changed
  mutate(longitude = as.numeric(LON), latitude = as.numeric(LAT)) %>%
  select(FLIGHT_ID, EVENT_TIME, longitude, latitude)

f <- export_flights_at_airport_fr24("2017-09-01T00:00:00Z",
                                    "2017-09-02T00:00:00Z",
                                    "SVG",
                                    flow = "ARR") %>%
  rename(callsign = CALLSIGN) %>%
  select(FLIGHT_ID, callsign)

p1 <- p %>% left_join(f) %>% filter(!is.na(callsign))
plot_flight_horizontal(p1)

## End(Not run)

euctrl-pru/trrrj documentation built on April 15, 2024, 1:24 p.m.