| Title: | Flight trajectories analysis |
|---|---|
| Description: | Functions to a) read FlightRadar24's live feed JSON files, archived data; b) import CPR data from NM's archived files; c) Plot 2D trajectories, vertical profiles both in time and track distance; d) analyse trajectories. |
| Authors: | Enrico Spinielli [aut, cre] (ORCID: <https://orcid.org/0000-0001-8584-9131>), EUROCONTROL [cph, fnd] |
| Maintainer: | Enrico Spinielli <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.7 |
| Built: | 2026-12-05 20:32:09 UTC |
| Source: | https://github.com/euctrl-pru/trrrj |
Return the ICAO IRAC id for a date
airac(date)airac(date)
date |
a date (or a ymd representation of it) |
the ICAO AIRCA id
Other airac:
airac_epoch(),
airac_interval(),
airac_year_epoch(),
cfmu_airac(),
cfmu_airac_epoch(),
cfmu_airac_epoch_number(),
cfmu_airac_interval()
airac('2019-01-30')airac('2019-01-30')
AIRAC epoch is defined in section 2.6.2 b) of
airac_epoch()airac_epoch()
the AIRAC epoch according to ICAO scheme
Other airac:
airac(),
airac_interval(),
airac_year_epoch(),
cfmu_airac(),
cfmu_airac_epoch(),
cfmu_airac_epoch_number(),
cfmu_airac_interval()
airac_epoch()airac_epoch()
The interval od dates for an (ICAO) AIRAC
airac_interval(airac)airac_interval(airac)
airac |
the ICAO AIRAC, i.e. "1603" for the 3rd AIRAC of 2016 |
an interval of (28) days coverad by the AIRAC airac
Other airac:
airac(),
airac_epoch(),
airac_year_epoch(),
cfmu_airac(),
cfmu_airac_epoch(),
cfmu_airac_epoch_number(),
cfmu_airac_interval()
airac_interval("1603")airac_interval("1603")
year
Return the effective date of the first AIRAC for year year
airac_year_epoch(year)airac_year_epoch(year)
year |
a year (as integer) |
the WEF date for the first AIRAC of the year year
Other airac:
airac(),
airac_epoch(),
airac_interval(),
cfmu_airac(),
cfmu_airac_epoch(),
cfmu_airac_epoch_number(),
cfmu_airac_interval()
airac_year_epoch(2018)airac_year_epoch(2018)
A dataset containing aircraft types as "published" at ICAO's Aicraft Type Designator page.
aircrafttypeaircrafttype
A data frame with 9290 rows and 19 variables.
The variables are a joint of flight information from flts with
the following ones:
Full name of the aircraft model
Description of the aircraft type. The first character is L = landplane, S = seaplane, A = amphibian, H = helicopter, G = gyrocopter, T = tilt-wing aircraft. The second character is about the number of engines 1 thru 8 or C applicable to fixed-wing aircraft only and indicating that two engines are coupled to drive a single propeller system. The fird character is for the type of engine with P = piston engine, T = turboprop/turboshaft engine, J = jet engine, E = electric engine
The Wake Turbulence Category (WTC) indicator defined according to the certificated maximum take-off mass (MTOM). H = heavy (300000 lb), M = medium (less than 136000 kg (300000 lb) and more than 7000 kg (15500 lb))
The aircraft type designator
The aircraft manufacturer code
The aircraft kind, see the first character of the Description field.
The number of engines, see the second character of the Description field.
The engine type, see the third character of the Description field.
https://www.icao.int/publications/DOC8643/Pages/Search.aspx
d
bbox_at_distance returns an st_bbox object representing
the extent of an axis-aligned bounding box containing the (polygonal approximation of a)
a circle at dithance d.
WARNING: current implementation relies on polygon_at_distance which is
not robust to cope with circles containing the Poles or crossing the date line.
bbox_at_distance(geo, d, ...)bbox_at_distance(geo, d, ...)
geo |
a geographical position [lon, lat] |
d |
a distance in Nautical Miles |
... |
other parameters passed to |
an st_bbox object
Other spatial:
bounding_box(),
crs_tc(),
filter_positions_at_range(),
polygon_at_distance(),
polygon_from_coords()
## Not run: fra <- c(8.570556, 50.03333) # Frankfurt Airport (longitude, latitude) bbox_at_distance(fra, 40) ## End(Not run)## Not run: fra <- c(8.570556, 50.03333) # Frankfurt Airport (longitude, latitude) bbox_at_distance(fra, 40) ## End(Not run)
Calculate a bounding box for a center point given a set of coordinates.
bounding_box(lat, lon, d)bounding_box(lat, lon, d)
lat |
latitude of the center point [decimal degrees]. |
lon |
longitude of the center point [decimal degrees]. |
d |
distance from the center point [Nautical Miles]. |
Returns a matrix with max/min latitude/longitude values.
http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates
Other spatial:
bbox_at_distance(),
crs_tc(),
filter_positions_at_range(),
polygon_at_distance(),
polygon_from_coords()
## Not run: bounding_box(38.8977, 77.0366, 1) ## End(Not run)## Not run: bounding_box(38.8977, 77.0366, 1) ## End(Not run)
return the CFMU AIRAC cycle number for a date
cfmu_airac(date)cfmu_airac(date)
date |
a date |
a number indicating the AIRAC cycle according to CFMU scheme
Other airac:
airac(),
airac_epoch(),
airac_interval(),
airac_year_epoch(),
cfmu_airac_epoch(),
cfmu_airac_epoch_number(),
cfmu_airac_interval()
cfmu_airac('2019-01-30')cfmu_airac('2019-01-30')
The interval of dates for a CFMU AIRAC number
cfmu_airac_interval(cfmu_airac)cfmu_airac_interval(cfmu_airac)
cfmu_airac |
a CFMU AIRAC number |
an interval of dates (28 days)
Other airac:
airac(),
airac_epoch(),
airac_interval(),
airac_year_epoch(),
cfmu_airac(),
cfmu_airac_epoch(),
cfmu_airac_epoch_number()
cfmu_airac_interval(441)cfmu_airac_interval(441)
A dataset containing CPR's for 41 flights flying over Europe. One on 4th , 19 on 5th and 21 on 6th Feb 2017.
cprscprs
A data frame with 53940 rows and 10 variables:
CPR Message (CPM) line number
TACT Id, TACT (a.k.a. ETFMS) is an NM system
time of CPM reception by the ETFMS system
time of track
block number. ETFMS internal use
record number. ETFMS internal use
Entry Node (EN) system area code (SAC).
To avoid ambiguity in the exchange of Surveillance related data,
each system using the ASTERIX data format gets assigned a unique
identifier composed of two values called SAC/SIC.
See https://www.eurocontrol.int/services/system-area-code-list
Entry Node (EN) system identifier code (SIC).
To avoid ambiguity in the exchange of Surveillance related data,
each system using the ASTERIX data format gets assigned a unique
identifier composed of two values called SAC/SIC.
The System Identification Code (SIC) is allocated nationally by
the responsible Air Traffic Services Organisation.
It identifies each individual system (surveillance sensor,
surveillance data processing system, etc) within the respective
area defined by the SAC.
See https://www.eurocontrol.int/services/system-area-code-list
Callsign for the flight as provided in the FPL (Flight PLan). It may be the registration marking of the aircraft or the ICAO designator for the aircraft operating agency followed by the flight identification
ICAO location identifier of the Airport of Departure (ADEP)
ICAO location identifier of the Airport of Destination (ADES)
Estimate Take-Off Date and Time (EOBT), the estimated time at which the aircraft will commence movement associated with departure
longitude (decimal degrees)
latitude (decimal degrees)
flight level of the aircraft. Flight levels are surfaces of constant atmospheric pressure which are related to a specific pressure datum, 1013.2 HP (Hecto-Pascal). The expression ‘Flight level times 100’ is sometimes, not quite correctly, referred to as altitude in feet
Determines whether the CPR is the first (Begin), an intermediate (Continuing) or the last (End) CPR sent by the corresponding system for the relevant flight. (Begin_And_End is also possible)
A 4-Digit octal code used in the transponder to identify an aircraft (SSR Mode 3/A). See https://en.wikipedia.org/wiki/Aviation_transponder_interrogation_modes
calculated ground velocity (knots) based on the previous radar position
calculated heading of aircraft with respect to the magnetic North (decimal degrees)
Climb (positive) or descend (negative) rate (knots)
a categorical value for the rate of climb, it can be one of CLIMB, DESCENT, LEVEL_FLIGHT or UNDETERMINED
a unique flight plan identifier assigned by the IFPS system
a unique identification of the aircrafts frame (24-bit ICAO aircraft address)
EUROCONTROL's Network Manager
Traffic Complexity score computation uses a custom Albers Equal Area projection.
crs_tc()crs_tc()
the PROJ4 string for the map projection
parse_airspace_prisme for an example.
Other spatial:
bbox_at_distance(),
bounding_box(),
filter_positions_at_range(),
polygon_at_distance(),
polygon_from_coords()
The calculated distance also for position reports on the ground;
the algorithm used is the one of distCosine.
cumulative_distance(positions)cumulative_distance(positions)
positions |
the position reports for the flight |
a dataframe with a new cumulative_distance column (in km)
Other analysis:
cumulative_time(),
extract_segment(),
filter_outlier(),
resample(),
smooth_positions()
## Not run: cumulative_distance(poss) # calculate only the flown distance # NOTE: there is a gap in FR24 data between last ground position (if any) # and first in air one (typically at ~1500 ft). # The following code would certainly work better # would poss contain a position report for a very low altitude. cumulative_distance(poss %>% filter(altitude > 0)) ## End(Not run)## Not run: cumulative_distance(poss) # calculate only the flown distance # NOTE: there is a gap in FR24 data between last ground position (if any) # and first in air one (typically at ~1500 ft). # The following code would certainly work better # would poss contain a position report for a very low altitude. cumulative_distance(poss %>% filter(altitude > 0)) ## End(Not run)
Calculate the cumulative time (in s).
cumulative_time(positions, offblock = NULL, inblock = NULL)cumulative_time(positions, offblock = NULL, inblock = NULL)
positions |
the position reports for the flight |
offblock |
optional, the timestamp for offblock if
different from the first timestamp in the dataset.
It is either an |
inblock |
optional, the timestamp for inblock if different from the last timestamp in the dataset |
a dataframe with a new cumulative_time column (in min)
Other analysis:
cumulative_distance(),
extract_segment(),
filter_outlier(),
resample(),
smooth_positions()
## Not run: cumulative_time(poss) # calculate only the flown distance # NOTE: there is a gap in FR24 data between last ground position (if any) # and first in air one (typically at ~1500 ft). # The following code would certainly work better # would poss contain a position report for a very low altitude. cumulative_time(poss %>% filter(altitude > 0)) ## End(Not run)## Not run: cumulative_time(poss) # calculate only the flown distance # NOTE: there is a gap in FR24 data between last ground position (if any) # and first in air one (typically at ~1500 ft). # The following code would certainly work better # would poss contain a position report for a very low altitude. cumulative_time(poss %>% filter(altitude > 0)) ## End(Not run)
Convert Degree decimal Minute (DdM)) format to Decimal Degrees (DD).
ddm2dd(value)ddm2dd(value)
value |
a string representation of an angle (i.e. longitude) in Degree decimal Minute (DdM)), i.e. N51°28.65' |
a decimal (degrees) value
Other coordinates:
dms2dd(),
parse_lat_icao(),
parse_lon_icao()
ddm2dd("N51° 28.65'")ddm2dd("N51° 28.65'")
Convert Degree Minute Seconds (DMS) format to Decimal Degrees (DD)
dms2dd(value)dms2dd(value)
value |
a string representation of an angle (i.e. longitude) in Degree Minute Second (DMS)), i.e. "51° 43' 34.00\" N" \strong{Note} the escaping of double quote.
|
a decimal degrees value
Other coordinates:
ddm2dd(),
parse_lat_icao(),
parse_lon_icao()
ddm2dd("51° 43' 34.00\u0022 N")ddm2dd("51° 43' 34.00\u0022 N")
EGLL data.
egll_aptegll_apt
An object of class tbl_df (inherits from tbl, data.frame) with 5 rows and 7 columns.
UK AIP
Sample Reference Trajectories' flight data at EGLL.
egll_flightsegll_flights
An object of class spec_tbl_df (inherits from tbl_df, tbl, data.frame) with 45 rows and 9 columns.
Reference Trajectories
A dataset containing FlightRadar24's archived feed ADS-B flight information for XX flights. There are xx flights on d1 and yy on yy.
egll_flights_fr24egll_flights_fr24
A data frame with xxyy rows and 11 variables:
mode-S address in hexadecimal, as supplied by the Mode-S or ADS-B transponder
ICAO code for scheduled departure airport
ICAO code for scheduled arrival airport
e.g. CSA190, as supplied by the Mode-S or ADS-B transponder
unique identifier for the flight leg (integer)
unique aircraft identifier (text)
aircraft type (e.g. B733, as per ICAO classification?),
GLID for gliders,
GROUND for ground vehicles
flight number, e.g. OK190
date of the flight (what about the ones crssing midnight?)
FlightRadar24
Sample Reference Trajectories' position reports data at EGLL.
egll_positionsegll_positions
An object of class grouped_df (inherits from tbl_df, tbl, data.frame) with 18574 rows and 10 columns.
Reference Trajectories
A dataset containing FlightRadar24's archived ADS-B position reports
(combined with flight information of flts) for xx flights at EGLL.
There are xx flights on d1 and yy on d2.
egll_positions_fr24egll_positions_fr24
A data frame with zzzz rows and 19 variables.
The variables are a joint of flight information from flts with
the following ones:
unique identifier for the flight leg (integer)
altitude in feet (integer), as supplied by the Mode-S or ADS-B transponder
latitude in decimal degrees, data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)
longitude in decimal degrees, data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)
ground speed in knots (integer), data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)
datetime for the position report
1 = on ground, 0 = airborne
vertical speed
FlightRadar24
EGLL runways.
egll_rw_sfegll_rw_sf
An object of class sf (inherits from tbl_df, tbl, data.frame) with 2 rows and 2 columns.
UK AIP
ALL_FT+-based trajectories to SO6 formatExtract ALL_FT+-based trajectories from PRISME database and convert to
SO6 format.
export_allft_so6(wef, til, model = "CTFM", ...)export_allft_so6(wef, til, model = "CTFM", ...)
wef |
(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z" |
til |
(UTC) timestamp of LOBT TILl (excluded). |
model |
the trajectory model, one of FTFM, RTFM, CTFM, CPF |
... |
extra arguments passed to export_model_trajectory. |
You need to store your credentials to access the PRU tables in the following environment variables:
PRU_TEST_USR for the user id
PRU_TEST_PWD for the password
PRU_TEST_DBNAME for the database name
a dataframe of trajectory segments in SO6 format, see read_so6
for a description of the SO6 format.
Other read/export:
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: # BEWARE: this can take some long-ish time export_allft_so6("2010-06-16", "2010-06-17", model = "FTFM") # reduce the time scope to get the data quicker (and smaller) export_allft_so6("2010-06-16 10:00", "2010-06-16T11:00:11") ## End(Not run)## Not run: # BEWARE: this can take some long-ish time export_allft_so6("2010-06-16", "2010-06-17", model = "FTFM") # reduce the time scope to get the data quicker (and smaller) export_allft_so6("2010-06-16 10:00", "2010-06-16T11:00:11") ## End(Not run)
Extract APDS data from PRISME database. Note: there are 129 columns...
export_apds(wef, til)export_apds(wef, til)
wef |
date of With Effect From (included) |
til |
date of TILl instant (excluded) |
You need to store your credentials to access the ATMAP tables in the following environment variables:
PRU_ATMAP_USR for the user id
PRU_ATMAP_PWD for the password
PRU_ATMAP_DBNAME for the database name
a dataframe of airport reported movements
Other read/export:
export_allft_so6(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: export_apds("2019-04-10", "2019-04-11") ## End(Not run)## Not run: export_apds("2019-04-10", "2019-04-11") ## End(Not run)
Extract event-based trajectories from PRISME database and convert to SO6 format
export_event_so6(wef, til)export_event_so6(wef, til)
wef |
(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z" |
til |
(UTC) timestamp of LOBT TILl (excluded). |
You need to store your credentials to access the CPLX tables in the following environment variables:
PRU_CPLX_USR for the user id
PRU_CPLX_PWD for the password
PRU_CPLX_DBNAME for the database name
a dataframe of trajectory segments in SO6 format, see read_so6
for a description of the SO6 format.
Other read/export:
export_allft_so6(),
export_apds(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: # BEWARE: this can take some long-ish time export_event_so6("2010-06-16", "2010-06-17") # reduce the time scope to get the data quicker (and smaller) export_event_so6("2010-06-16 10:00", "2010-06-16T11:00:11") ## End(Not run)## Not run: # BEWARE: this can take some long-ish time export_event_so6("2010-06-16", "2010-06-17") # reduce the time scope to get the data quicker (and smaller) export_event_so6("2010-06-16 10:00", "2010-06-16T11:00:11") ## End(Not run)
Extract "Event"-based trajectories from PRISME database
export_event_trajectory(wef, til)export_event_trajectory(wef, til)
wef |
(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z" |
til |
(UTC) timestamp of LOBT TILl instant (excluded) |
You need to store your credentials to access the CPLX related tables in the following environment variables:
PRU_CPLX_USR for the user id
PRU_CPLX_PWD for the password
PRU_CPLX_DBNAME for the database name
a dataframe of trajectory points.
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: export_event_trajectory("2010-06-16", "2010-06-17") export_event_trajectory("2010-06-16 10:00", "2010-06-16T11:00:00Z") ## End(Not run)## Not run: export_event_trajectory("2010-06-16", "2010-06-17") export_event_trajectory("2010-06-16 10:00", "2010-06-16T11:00:00Z") ## End(Not run)
Export the flight list
export_flight_info(wef, til, lobt_buffer = c(before = 28, after = 24))export_flight_info(wef, til, lobt_buffer = c(before = 28, after = 24))
wef |
(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z" |
til |
(UTC) timestamp of LOBT TILl instant (excluded) |
lobt_buffer |
The number of hours before and after LOBT to query [default before = 28, after = 24]. This is related to how LOBT is stored in the underlying database table. |
a data frame of flight info
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: export_flight_info("2020-01-20", "2020-01-21") ## End(Not run)## Not run: export_flight_info("2020-01-20", "2020-01-21") ## End(Not run)
Extract FlightRadar24 flight movements in the specified period at an airport
export_flights_at_airport_fr24(wef, til, apt, flow = "ALL")export_flights_at_airport_fr24(wef, til, apt, flow = "ALL")
wef |
(UTC) timestamp of With Effect From (included) |
til |
(UTC) timestamp of TILl instant (excluded) |
apt |
IATA code of an airport, i.g. PSA for Pisa "Galileo Galilei" |
flow |
the flow of flights: "ARR" for arrivals, "DEP" for departures, "ALL" for both (default "ALL") |
You need to store your credentials to access the FR24 tables in the following environment variables:
PRU_FR24_USR for the user id
PRU_FR24_PWD for the password
PRU_FR24_DBNAME for the database name
a dataframe of flights
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: export_flights_at_airport_fr24("2017-09-01T00:00:00", "2017-09-02T00:00:00", "SVG", flow = "ARR") # only 2 hours interval export_flights_at_airport_fr24("2017-09-01 10", "2017-09-02T11:00:00", "SVG", flow = "ARR") ## End(Not run)## Not run: export_flights_at_airport_fr24("2017-09-01T00:00:00", "2017-09-02T00:00:00", "SVG", flow = "ARR") # only 2 hours interval export_flights_at_airport_fr24("2017-09-01 10", "2017-09-02T11:00:00", "SVG", flow = "ARR") ## End(Not run)
Extract FlightRadar24 flight movements in the specified period
export_flights_fr24(wef, til)export_flights_fr24(wef, til)
wef |
(UTC) timestamp of With Effect From (included) |
til |
(UTC) timestamp of TILl instant (excluded) |
You need to store your credentials to access the FR24 tables in the following environment variables:
PRU_FR24_USR for the user id
PRU_FR24_PWD for the password
PRU_FR24_DBNAME for the database name
a dataframe of flights
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: export_flights_fr24("2017-09-01T10:30:00", "2017-09-01 11") ## End(Not run)## Not run: export_flights_fr24("2017-09-01T10:30:00", "2017-09-01 11") ## End(Not run)
Extract hourly-binned flights from PRISME database together with aircraft information such as registration, aircraft operator and ICAO 24-bit address
export_hourly_adsb(wef, til, model = "CTFM", bbox = NULL)export_hourly_adsb(wef, til, model = "CTFM", bbox = NULL)
wef |
(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z" |
til |
(UTC) timestamp of LOBT TILl instant (excluded) |
model |
the model of the profile: one of "FTFM", "CTFM", "CPF". [default: "CFTM"] |
bbox |
(Optional) axis aligned bounding box (xmin, ymin, xmax, ymax) |
You need to store your credentials to access the PRU tables in the following environment variables:
PRU_DEV_USR for the user id
PRU_DEV_PWD for the password
PRU_DEV_DBNAME for the database name
a dataframe with trajectory data
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: # export all hourly CTFM flights within a bounding box 40 NM around EDDF bb <- c(xmin = 7.536746, xmax = 9.604390, ymin = 49.36732, ymax = 50.69920) export_hourly_adsb("2019-01-01 00:00", "2019-01-02 00:00", bbox = bb) ## End(Not run)## Not run: # export all hourly CTFM flights within a bounding box 40 NM around EDDF bb <- c(xmin = 7.536746, xmax = 9.604390, ymin = 49.36732, ymax = 50.69920) export_hourly_adsb("2019-01-01 00:00", "2019-01-02 00:00", bbox = bb) ## End(Not run)
Extract NM point profile trajectories from PRISME database
export_model_trajectory( wef, til, model = "CTFM", bbox = NULL, lobt_buffer = c(before = 28, after = 24), timeover_buffer = NULL )export_model_trajectory( wef, til, model = "CTFM", bbox = NULL, lobt_buffer = c(before = 28, after = 24), timeover_buffer = NULL )
wef |
(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z" |
til |
(UTC) timestamp of LOBT TILl instant (excluded) |
model |
the model of the profile: one of CPF, CTFM, DCT, FTFM, SCR, SRR, SUR [default: "CFTM"]. |
bbox |
(Optional) axis aligned bounding box (xmin, ymin, xmax, ymax) |
lobt_buffer |
(Optional) number of (portion of) hours buffer for LOBT before/after
|
timeover_buffer |
(Optional) number of (portion of) hours buffer for |
You need to store your credentials to access the PRU tables in the following environment variables:
PRU_DEV_USR for the user id
PRU_DEV_PWD for the password
PRU_DEV_DBNAME for the database name
a dataframe with trajectory data
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: # export 1 day worth of NM (planned) trajectories export_model_trajectory("2019-07-14", "2019-07-15", model = "FTFM") # export 2 hours of NM (flown) trajectories export_model_trajectory("2019-07-14 22:00", "2019-07-15") # export 1 day of NM (flown) trajectories export_model_trajectory("2019-07-14", "2019-07-15", lobt_buffer = c(before = 24, after = 1.25)) # export all CTFM trajectories within a bounding box 40 NM around EDDF bb <- c(xmin = 7.536746, xmax = 9.604390, ymin = 49.36732, ymax = 50.69920) export_model_trajectory("2019-01-01 00:00", "2019-01-02 00:00", bbox = bb) ## End(Not run)## Not run: # export 1 day worth of NM (planned) trajectories export_model_trajectory("2019-07-14", "2019-07-15", model = "FTFM") # export 2 hours of NM (flown) trajectories export_model_trajectory("2019-07-14 22:00", "2019-07-15") # export 1 day of NM (flown) trajectories export_model_trajectory("2019-07-14", "2019-07-15", lobt_buffer = c(before = 24, after = 1.25)) # export all CTFM trajectories within a bounding box 40 NM around EDDF bb <- c(xmin = 7.536746, xmax = 9.604390, ymin = 49.36732, ymax = 50.69920) export_model_trajectory("2019-01-01 00:00", "2019-01-02 00:00", bbox = bb) ## End(Not run)
Export the flight list of movements at an airport
export_movements( apt, wef, til, type = "both", lobt_buffer = c(before = 28, after = 24) )export_movements( apt, wef, til, type = "both", lobt_buffer = c(before = 28, after = 24) )
apt |
ICAO code of the airport, i.e. "EDDF" |
wef |
(UTC) timestamp of LOBT With Effect From (included). Liberal format, i.e. "2019-07-14", "2019-07-14 10:21" "2019-07-14T10:21:23Z" |
til |
(UTC) timestamp of LOBT TILl instant (excluded) |
type |
Type of movement; 'arr' for arrivals, 'dep' for departures 'both' for arrivals and departures. [default 'both'] |
lobt_buffer |
The number of hours before and after LOBT to query [default before = 28, after = 24]. This is related to how LOBT is stored in the underlying database table. |
a data frame of flight movements
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: export_movements("EDDF", "2020-01-20", "2020-01-21") ## End(Not run)## Not run: export_movements("EDDF", "2020-01-20", "2020-01-21") ## End(Not run)
Extract FlightRadar24 positions within a distance from the aerodrome for qualified airport movements (arrivals or departures or all)
export_positions_at_airport_fr24( wef, til, apt, lon_apt, lat_apt, flow = "ALL", radius = 40 )export_positions_at_airport_fr24( wef, til, apt, lon_apt, lat_apt, flow = "ALL", radius = 40 )
wef |
(UTC) timestamp of With Effect From (included) |
til |
(UTC) timestamp of TILl instant (excluded) |
apt |
IATA airport code, i.e. PSA for Pisa "Galileo Galilei" |
lon_apt |
airport longitude (decimal degrees, WGS84) |
lat_apt |
airport latitude (decimal degrees, WGS84) |
flow |
the flow of flights: "ARR" for arrivals, "DEP" for departures, "ALL" for both [default "ALL"] |
radius |
radius around airport to keep position reports (nautical miles [NM]) |
You need to store your credentials to access the FR24 tables in the following environment variables:
PRU_FR24_USR for the user id
PRU_FR24_PWD for the password
PRU_FR24_DBNAME for the database name
dataframe of ADS-B position reports
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: # half a day (UTC times, not local ones!) worth of all movements at Stavanger Airport, # Sola, Sweden on 1st Sep 2017 export_positions_at_airport_fr24("2017-09-01T00:00:00", "2017-09-01T12:00:00", "SVG", 5.638, 58.877) # all arrivals within 50 NM on 25th Sep 2018 at Pisa Airport, Pisa, Italy export_positions_at_airport_fr24("2018-09-25", "2018-09-26", "PSA", 10.39270, 43.68390, flow = "ARR", radius = 50) ## End(Not run)## Not run: # half a day (UTC times, not local ones!) worth of all movements at Stavanger Airport, # Sola, Sweden on 1st Sep 2017 export_positions_at_airport_fr24("2017-09-01T00:00:00", "2017-09-01T12:00:00", "SVG", 5.638, 58.877) # all arrivals within 50 NM on 25th Sep 2018 at Pisa Airport, Pisa, Italy export_positions_at_airport_fr24("2018-09-25", "2018-09-26", "PSA", 10.39270, 43.68390, flow = "ARR", radius = 50) ## End(Not run)
You need to store your credentials to access the FR24 tables in the following environment variables:
PRU_FR24_USR for the user id
PRU_FR24_PWD for the password
PRU_FR24_DBNAME for the database name
export_positions_fr24(wef, til)export_positions_fr24(wef, til)
wef |
(UT) timestamp of With Effect From (included) |
til |
(UT) timestamp of TILl instant (excluded) |
a dataframe of position reports
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: export_positions_fr24("2017-09-01T00:00:00Z", "2017-09-01T06:00:00Z") export_positions_fr24("2017-09-01 10:05:00Z", "2017-09-01T11:33:00") ## End(Not run)## Not run: export_positions_fr24("2017-09-01T00:00:00Z", "2017-09-01T06:00:00Z") export_positions_fr24("2017-09-01 10:05:00Z", "2017-09-01T11:33:00") ## End(Not run)
It is assumed that the dataset is grouped by flight id and that position reports are sorted by ascending timestamp.
extract_segment(prs, vert_limit = 5)extract_segment(prs, vert_limit = 5)
prs |
dataset containing position reports.
Two variables are used: |
vert_limit |
the maximum absolute vertical rate for a segment to be considered level (default = 5 feet/s) |
a dataset of level segments. A level segment is defined by its beginning and end 4D position.
Other analysis:
cumulative_distance(),
cumulative_time(),
filter_outlier(),
resample(),
smooth_positions()
## Not run: cumulative_time(poss) f <- cprs %>% filter(callsign == "RYR40WJ") %>% arrange(timestamp_track) %>% rename(timestamp = timestamp_track) %>% mutate(altitude = flight_level * 100) extract_segment(f) ## End(Not run)## Not run: cumulative_time(poss) f <- cprs %>% filter(callsign == "RYR40WJ") %>% arrange(timestamp_track) %>% rename(timestamp = timestamp_track) %>% mutate(altitude = flight_level * 100) extract_segment(f) ## End(Not run)
The col values are processed through a median (i.e. low pass) filter
to get .<col>_median, the squared differences between
them .<col>_eps2, and its mean .<col>_sigma.
A col value is considered an outlier if .<col>_eps2 is greater then
.<col>_sigma.
filter_outlier(df, col, ksize, fill, keep = FALSE)filter_outlier(df, col, ksize, fill, keep = FALSE)
df |
a data frame of trajectory data |
col |
the variable to filter for outliers |
ksize |
the kernel size (must be odd) |
fill |
whether to substitute the outlier with the median |
keep |
whether to keep intermediate results |
This approach is inspired by (copied from ;-) the filter function
in Xavier Olive's Python library
traffic.
a data frame with corrected outliers (if fill is TRUE).
If keep is TRUE the intermediate columns .<col>_median,
.<col>_eps2, .<col>_sigma and .<col>_outlier are included.
Other analysis:
cumulative_distance(),
cumulative_time(),
extract_segment(),
resample(),
smooth_positions()
## Not run: library(readr) library(dplyr) library(anytime) library(trrrj) library(ggplot2) ifile <- system.file("extdata", "belevingsvlucht.csv", package = "trrrj") df <- readr::read_csv(ifile) %>% mutate(timestamp = anytime::anytime(time, tz = "UTC")) df1 <- df %>% filter_outlier(col = baroaltitude, ksize = 17, fill = TRUE, keep = FALSE) ggplot() + geom_line(data = df, mapping = aes(x = timestamp, y = baroaltitude), colour = "blue") + geom_line(data = df1, mapping = aes(x = timestamp, y = baroaltitude), colour = "red") ## End(Not run)## Not run: library(readr) library(dplyr) library(anytime) library(trrrj) library(ggplot2) ifile <- system.file("extdata", "belevingsvlucht.csv", package = "trrrj") df <- readr::read_csv(ifile) %>% mutate(timestamp = anytime::anytime(time, tz = "UTC")) df1 <- df %>% filter_outlier(col = baroaltitude, ksize = 17, fill = TRUE, keep = FALSE) ggplot() + geom_line(data = df, mapping = aes(x = timestamp, y = baroaltitude), colour = "blue") + geom_line(data = df1, mapping = aes(x = timestamp, y = baroaltitude), colour = "red") ## End(Not run)
The points whose distance, .distance, satisfies
are kept (.exclude = FALSE) or excluded (.exclude = TRUE)
filter_positions_at_range( df, geo, dm, dM, lon, lat, .exclude = FALSE, .keep = FALSE )filter_positions_at_range( df, geo, dm, dM, lon, lat, .exclude = FALSE, .keep = FALSE )
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 |
lat |
the column for latitude in |
.exclude |
exclude the point in the ( |
.keep |
keep the calculated distance (in Nautical Miles)
in the |
a subset of df
Other spatial:
bbox_at_distance(),
bounding_box(),
crs_tc(),
polygon_at_distance(),
polygon_from_coords()
## Not run: 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) ## End(Not run)## Not run: 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) ## End(Not run)
A dataset containing FlightRadar24's archived feed ADS-B flight information for 41 flights, 2 gliders (equip == "GLID") and one ground vehicle (equip == "GROUND"). There are 20 flights on 5th and 21 on 6th Feb 2017.
fltsflts
A data frame with 43 rows and 11 variables:
unique identifier for the flight leg (integer)
mode-S address in hexadecimal, as supplied by the Mode-S or ADS-B transponder
unique aircraft identifier (text)
aircraft type (e.g. B733, as per ICAO classification?),
GLID for gliders,
GROUND for ground vehicles
e.g. CSA190, as supplied by the Mode-S or ADS-B transponder
flight number, e.g. OK190
IATA code for scheduled departure airport
IATA code for scheduled arrival airport
IATA code for actual arrival airport (when diverted)
date of the flight (what about the ones crssing midnight?)
FlightRadar24
The data frame for point trajectories needs to have the following columns:
| Name | Description | Type |
flight_id |
Flight ID | int |
time_over |
Time over point | datetime |
longitude |
Longitude (decimal degrees) | double |
latitude |
Latitude (decimal degrees) | double |
flight_level |
Flight level | int |
point_id |
Point ID or NO_POINT | char |
air_route |
Air route or NO_ROUTE | char |
lobt |
Last Off-block Time | datetime |
seq_id |
Positions's sequence number | int |
callsign |
Flight call sign | char |
registration |
Aircraft registration | char |
model |
Aircraft model | char |
aircraft_type |
Aircraft ICAO type | char |
aircraft_operator |
Aircraft operator | char |
adep |
Departing aerodrome (ICAO) ID | char |
ades |
Destination aerodrome (ICAO) ID | char |
generate_so6(trajectory)generate_so6(trajectory)
trajectory |
A data frame for point trajectories. |
A data frame for trajectories in SO6 format, see read_so6
for a description of the SO6 format.
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: generate_so6(trj) ## End(Not run)## Not run: generate_so6(trj) ## End(Not run)
parse_airspace_prisme reads the airspace PRISME format and returns a tibble
where each row describes an airspace.
Each airspace in PRISME format is described by:
Airspace description (one row):
an airspace Unit code
a Elementary Sector code
minimum flight level
maximum flight level
the number of vertices of the polygon of the Elementary Sector
the coordinates of vertices
vertex coordinates (as many rows as the number of vertices)
parse_airspace_prisme(lines)parse_airspace_prisme(lines)
lines |
text lines of the PRISME airspace representation |
a tibble of airspaces (CRS = 4326)
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: es <- system.file("extdata", "airspace_prisme_462.prisme", package = "trrrj") sectors <- readr::read_lines(es) %>% parse_airspace_prisme() ## End(Not run)## Not run: es <- system.file("extdata", "airspace_prisme_462.prisme", package = "trrrj") sectors <- readr::read_lines(es) %>% parse_airspace_prisme() ## End(Not run)
The format is as described in ICAO Doc 8126 section 5.5.2 bullet d):
In the indication of the geographical coordinates of
a location:
- the latitude should be given first;
- symbols for degrees, minutes or seconds should
be omitted;
- two digits should always be used in expressing
values of less than 10 degrees of latitude; and
- three digits should always be used in expressing
values of less than 100 degrees of longitude.
For example, 050735N 0652542W means five
degrees, seven minutes and thirty-five seconds
North, sixty-five degrees, twenty-five minutes and
forty-two seconds West.
What is typical in AIP pubblications is the additional part
of decimal seconds, like 554718.23N.
parse_lat_icao(lat)parse_lat_icao(lat)
lat |
a string representation for latitude,
i.e. |
This format is used in AIP pubblications, for examples for runway threshold
coordinates, stand positions, etc.
This is used also in ALL_FT+ files from NM.
a latitude in decimal degrees
Other coordinates:
ddm2dd(),
dms2dd(),
parse_lon_icao()
parse_lat_icao("554718N")parse_lat_icao("554718N")
The format is as described in ICAO Doc 8126 section 5.5.2 bullet d):
In the indication of the geographical coordinates of
a location:
- the latitude should be given first;
- symbols for degrees, minutes or seconds should
be omitted;
- two digits should always be used in expressing
values of less than 10 degrees of latitude; and
- three digits should always be used in expressing
values of less than 100 degrees of longitude.
For example, 050735N 0652542W means five
degrees, seven minutes and thirty-five seconds
North, sixty-five degrees, twenty-five minutes and
forty-two seconds West.
What is typical in AIP pubblications is the additional part
of decimal seconds, like 554718.23N.
parse_lon_icao(lon)parse_lon_icao(lon)
lon |
a string representation for longitude, i.e. |
This format is used in AIP pubblications, for examples for runway threshold
coordinates, stand positions, etc.
This is used also in ALL_FT+ files from NM.
decimal degress value
Other coordinates:
ddm2dd(),
dms2dd(),
parse_lat_icao()
parse_lon_icao("0114901W")parse_lon_icao("0114901W")
Plot CPR trajectories on a map
plot_cpr_horizontal(poss, bbox = NULL, ...)plot_cpr_horizontal(poss, bbox = NULL, ...)
poss |
a dataframe of correlated position reports (CPRs) with (at least)
|
bbox |
a bounding box in the format
|
... |
Extra parameters to pass further on. |
a ggplot2 plot
Other plot:
plot_flight_horizontal(),
plot_flight_vertical_distance(),
plot_flight_vertical_time()
## Not run: # plot CPR tryjectories europe <- c(left = 5, bottom = 35, right = 30, top = 52) plot_cpr_horizontal(cprs, europe) ## End(Not run)## Not run: # plot CPR tryjectories europe <- c(left = 5, bottom = 35, right = 30, top = 52) plot_cpr_horizontal(cprs, europe) ## End(Not run)
Plot the recorded positions of a flight on a map.
plot_flight_horizontal( poss, bbox = NULL, buffer = 100, legend.position = "none", shape = NULL, ... )plot_flight_horizontal( poss, bbox = NULL, buffer = 100, legend.position = "none", shape = NULL, ... )
poss |
a dataframe of position reports with (at least)
|
bbox |
a bounding box in the format
|
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 |
... |
Extra parameters to pass further on. |
a ggplot2 plot object.
Other plot:
plot_cpr_horizontal(),
plot_flight_vertical_distance(),
plot_flight_vertical_time()
## 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)## 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)
Plot the vertical profile of the recorded positions of a flight from lapsed distance perspective.
plot_flight_vertical_distance(poss)plot_flight_vertical_distance(poss)
poss |
a dataframe of position reports with (at least)
|
a ggplot2 plot object.
Other plot:
plot_cpr_horizontal(),
plot_flight_horizontal(),
plot_flight_vertical_time()
## Not run: plot_flight_vertical_distance(poss) ## End(Not run)## Not run: plot_flight_vertical_distance(poss) ## End(Not run)
Plot the vertical profile of the recorded positions of a flight from lapsed time perspective.
plot_flight_vertical_time(poss)plot_flight_vertical_time(poss)
poss |
a dataframe of position reports with (at least)
|
a ggplot2 plot object.
Other plot:
plot_cpr_horizontal(),
plot_flight_horizontal(),
plot_flight_vertical_distance()
## Not run: plot_flight_vertical_time(poss) ## End(Not run)## Not run: plot_flight_vertical_time(poss) ## End(Not run)
polygon_at_distance returns a polygon approximating a circonference
at distance d, in Nautical Miles, from the location geo.
You can control how many points per quadrant will be used via the
nQuadSegs parameter (the default of 30 from st_buffer should
suffice for most of the needs.)
WARNING: this is not tested to work across the date line or for polygons containing the poles or for polygons spanning more than half an emisphere.
polygon_at_distance(geo, d, ...)polygon_at_distance(geo, d, ...)
geo |
a geographical location in lon/lat (WGS84) |
d |
a distance in Nautical Miles |
... |
other parameters, for example |
a polygon.
Other spatial:
bbox_at_distance(),
bounding_box(),
crs_tc(),
filter_positions_at_range(),
polygon_from_coords()
## Not run: fra <- c(8.570556, 50.03333) # Frankfurt Airport (longitude, latitude) polygon_at_distance(fra, 40) ## End(Not run)## Not run: fra <- c(8.570556, 50.03333) # Frankfurt Airport (longitude, latitude) polygon_at_distance(fra, 40) ## End(Not run)
Return a polygon from (WGS84) coordinates
polygon_from_coords(coords, dfMaxLength = units::set_units(1, "km"))polygon_from_coords(coords, dfMaxLength = units::set_units(1, "km"))
coords |
coordinates defining a polygon |
dfMaxLength |
maximum length of a line segment. If |
an sf polygon
Other spatial:
bbox_at_distance(),
bounding_box(),
crs_tc(),
filter_positions_at_range(),
polygon_at_distance()
## Not run: coords <- list(rbind(c(0, 0), c(1, 0), c(1, 1), c(0.5, 1.5), c(0, 1), c(0, 0))) polygon_from_coords(coords) ## End(Not run)## Not run: coords <- list(rbind(c(0, 0), c(1, 0), c(1, 1), c(0.5, 1.5), c(0, 1), c(0, 0))) polygon_from_coords(coords) ## End(Not run)
A dataset containing FlightRadar24's archived ADS-B position reports
(combined with flight information of flts) for 41 flights.
There are 20 flights on 5th and 21 on 6th Feb 2017.
possposs
A data frame with 9290 rows and 19 variables.
The variables are a joint of flight information from flts with
the following ones:
unique identifier for the flight leg (integer)
datetime for the position report (convertion of
snapshot_id)
time of sample as number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970
altitude in feet (integer), as supplied by the Mode-S or ADS-B transponder
degrees from North, 0-359, (integer), data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)
latitude in decimal degrees, data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)
longitude in decimal degrees, data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)
unique identifier of primary ground receiver
ground speed in knots (integer), data supplied by ADS-B but calculated for mode-S transponders and tracked using multi-lateration (MLAT)
code broadcast by airplane represented as four octal digits, data supplied directly from the mode-S or ADS-B transponder
mode-S address in hexadecimal, as supplied by the Mode-S or ADS-B transponder
unique aircraft identifier (text)
aircraft type (e.g. B733, as per ICAO classification?),
GLID for gliders,
GROUND for ground vehicles
e.g. CSA190, as supplied by the Mode-S or ADS-B transponder
flight number, e.g. OK190
IATA code for scheduled departure airport
IATA code for scheduled arrival airport
IATA code for actual arrival airport (when diverted)
date of the flight (what about the ones crossing midnight?)
FlightRadar24
The payload of an archived CPR file contains the following fields:
| Name | Description | Type |
| cpm_id | CPR Message ID | int |
| tact_id | ETFMS flight ID | int |
| timestamp_etfms | ETFMS reception timestamp | char (YY/MM/DD hh:mm:ss) |
| timestamp_track | track timestamp | char (YY/MM/DD hh:mm:ss) |
| block | Block number | int |
| record | Record number (index within a block) | int |
| entry_node_sac | Entry Node system area code | int |
| entry_node_sic | Entry Node system identifier code | int |
| callsign | Callsign of flight | char |
| adep_icao | ICAO code of Departure aerodrome | char |
| ades_icao | ICAO code of Destination aerodrome | char |
| eobt | Estimated Off-block Time | char (YY/MM/DD hh:mm:ss) |
| longitude | Longitude (WGS84) | decimal degrees |
| latitude | Latitude (WGS84) | decimal degrees |
| flight_level | Flight level | integer |
| track_service | Track service | char (Begin, Continuing, End or Begin_And_End) |
| ssr_code | SSR code | oct |
| track_speed | Track velocity (in Knots) | int |
| track_heading | Track heading | char |
| climb_rate | Climb or descend rate | int |
| track_vertical_mode | vertical attitude | char (Climb, Descend, Level_Flight or Undetermined) |
| ifps_id | IFPS flight plan id | char |
| aircraft_address | ICAO 24-bit address | char |
read_cpr(file, delim = ";")read_cpr(file, delim = ";")
file |
A (gzipped) file containing archived CPR's as received
received and processed by the Network Manager.
Filenames are something like
|
delim |
the character delimiting the fields [default = ";"] |
A dataframe of correlated position reports (CPR's)
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_flights_fr24(),
read_positions_fr24(),
read_so6()
## Not run: # read CPR's of the 20 sample flights for 5th Feb 2017 cprs_file <- system.file("extdata", "1.201702051001tacop304ARCHIVED_OPLOG_ALL_CPR.gz", package = "trrrj") cprs05 <- read_cpr(cprs_file) ## End(Not run)## Not run: # read CPR's of the 20 sample flights for 5th Feb 2017 cprs_file <- system.file("extdata", "1.201702051001tacop304ARCHIVED_OPLOG_ALL_CPR.gz", package = "trrrj") cprs05 <- read_cpr(cprs_file) ## End(Not run)
read_flights_fr24 returns all flights as archived by FR24
for a given day (see path parameter for how the date is
encoded).
read_flights_fr24(path)read_flights_fr24(path)
path |
the filename of the |
The flights listed are the ones known to FR24 and fitting the the bounding box as contractually agreed.
a data frame of the archived flights that have flown on <yyyymmdd>.
Each flight has the following attributes (all optional, i.e. eventually empty,
but flight_id):
date date of the flight
flight_id unique decimal identifier for the flight leg
aircraft_id mode-S address in hexadecimal
reg unique aircraft text identifier
equip equipment, e.g. B733
callsign callsign, e.g. NAX11S
flight flight number, e.g. DY311
schd_from IATA code for scheduled departure airport, e.g. KKN
schd_to IATA code for scheduled arrival airport
real_to IATA code for actual arrival airport (when diverted)
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_positions_fr24(),
read_so6()
## Not run: # flights, as recorded by FR24, on 20170205 (5th Feb 2017) flt_fr24_file <- system.file("extdata", "20170205_flights.csv", package = "trrrj") read_flights_fr24(flt_fr24_file) ## End(Not run)## Not run: # flights, as recorded by FR24, on 20170205 (5th Feb 2017) flt_fr24_file <- system.file("extdata", "20170205_flights.csv", package = "trrrj") read_flights_fr24(flt_fr24_file) ## End(Not run)
read_positions_fr24 returns all position reports as archived by FR24
for a given flight_id flown on a specific day (see path
parameter for how the date and flight ID are encoded).
read_positions_fr24(path)read_positions_fr24(path)
path |
the filename of the |
The positions listed are the ones known to FR24 and fitting the the bounding box as contractually agreed.
a data frame of the archived flight's positions for date <yyyymmdd>.
Each position report has the following attributes (all mandatory, i.e. non empty,
but speed, squawk and vert_speed):
flight_id FR24 unique (within a day?) flight leg identifier
timestamp snapshot_id converted to a date/time
snapshot_id time of sample in Unix epoch seconds,
i.e. since 1st Jan 1970 00:00:00 UTC
altitude altitude (feet). Barometric relative to ISO 1013 hPa
pressure in flight, always 0 on ground.
heading 0-359 degrees
latitude latitude in decimal degrees
longitude longitude in decimal degrees
radar_id unique identifier of primary ground receiver
speed ground speed (knots)
squawk code broadcast by airplane, represented as four
octal digits
vert_speed vertical speed (feet/min). Calculated from rate
of altitude changes, 0 for level flight or empty if unavailable
on_ground 1 for on ground, 0 for airborne.
Calculated from low altitude and ground speed
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_so6()
## Not run: # positions, as recorded by FR24, for flight 207535493 on 20170205 (5th Feb 2017) pos_fr24_file <- system.file("extdata", "20170205_positions", "20170205_207535493.csv", package = "trrrj") read_positions_fr24(pos_fr24_file) ## End(Not run)## Not run: # positions, as recorded by FR24, for flight 207535493 on 20170205 (5th Feb 2017) pos_fr24_file <- system.file("extdata", "20170205_positions", "20170205_207535493.csv", package = "trrrj") read_positions_fr24(pos_fr24_file) ## End(Not run)
The SO6 file has variables of two types:
Segment-specific data (latitude/longitude, time/data information, ...)
Flight meta data (flight id, callsign, aircraft type, ...)
They are marked S or F respectively in the table below.
| Name | Description | Type | Kind |
segment_id |
segment Id | char | S |
adep |
Departing aerodrome (ICAO) ID | char | F |
ades |
Destination aerodrome (ICAO) ID | char | S |
aircraft_type |
ICAO aircraft type | char | S |
segment_hhmm_begin |
Segment's begin timestamp (hhmmss) | char | S |
segment_hhmm_end |
Segment's end timestamp (hhmmss) | char | S |
segment_fl_begin |
Segment's begin flight level | int | S |
segment_fl_end |
Segment's end flight level | int | S |
status |
Segment's status (0=climb, 1=descent, 2=cruise) | factor | S |
callsign |
Flight call sign | char | F |
segment_date_begin |
Segment's begin date (YYMMDD) | char | S |
segment_date_end |
Segment's end date (YYMMDD) | char | S |
segment_latitude_begin |
Segment's begin latitude (Min decimal) | char | S |
segment_longitude_begin |
Segment's begin longitude (Min decimal) | char | S |
segment_latitude_end |
Segment's end latitude (Min decimal) | char | S |
segment_longitude_end |
Segment's end longitude (Min decimal) | char | S |
flight_id |
Flight ID | int | F |
sequence |
Segment's sequence | int | S |
segment_length |
Segment's length | double | S |
segment_parity |
Segment's parity | int | S |
segment_timestamp_begin |
Segment's begin timestamp | datetime | S |
segment_timestamp_end |
Segment's end timestamp | datetime | S |
point_id_begin |
Segment's begin point ID | char | S |
point_id_end |
Segment's end point ID | char | S |
read_so6(filename, delim = " ")read_so6(filename, delim = " ")
filename |
the file containing SO6 trajectories |
delim |
the field delimiter (default: " " [blank]) |
a data frame where date and time are combined in a single datetime and longitude and latitude are in decimal degrees.
Other read/export:
export_allft_so6(),
export_apds(),
export_event_so6(),
export_event_trajectory(),
export_flight_info(),
export_flights_at_airport_fr24(),
export_flights_fr24(),
export_hourly_adsb(),
export_model_trajectory(),
export_movements(),
export_positions_at_airport_fr24(),
export_positions_fr24(),
generate_so6(),
parse_airspace_prisme(),
read_cpr(),
read_flights_fr24(),
read_positions_fr24()
## Not run: so6file <- system.file("extdata", "TRAFFIC_20180630_reduced.so6", package = "trrrj") read_so6(so6file) ## End(Not run)## Not run: so6file <- system.file("extdata", "TRAFFIC_20180630_reduced.so6", package = "trrrj") read_so6(so6file) ## End(Not run)
Each flight trajectory 4D positions are linearly interpolated at
interval seconds. First and last positions are retained.
resample(df, interval = 1L)resample(df, interval = 1L)
df |
a data frame of flight trajectories, each identified by
its own |
interval |
the amount of seconds to resample to |
a data frame of interpolated 4D positions at interval seconds
Other analysis:
cumulative_distance(),
cumulative_time(),
extract_segment(),
filter_outlier(),
smooth_positions()
## Not run: poss |> resample(300L) ## End(Not run)## Not run: poss |> resample(300L) ## End(Not run)
Smooth longitude, latitude and altitude.
smooth_positions(df, n = 5, type = "t")smooth_positions(df, n = 5, type = "t")
df |
a data frame of trajectory positions |
n |
from pracma::movavg |
type |
from pracma::movavg |
return a smoothed trajectory
Other analysis:
cumulative_distance(),
cumulative_time(),
extract_segment(),
filter_outlier(),
resample()
data(list = c("egll_positions_fr24"), package = "trrrj") smooth_positions(egll_positions_fr24)data(list = c("egll_positions_fr24"), package = "trrrj") smooth_positions(egll_positions_fr24)
trrrj comes bundled with a number of sample files in its inst/extdata
directory. This function make them easy to access
trrrj_example(path = NULL)trrrj_example(path = NULL)
path |
Name of file. If |
trrrj_example() trrrj_example("20170205_flights.csv")trrrj_example() trrrj_example("20170205_flights.csv")