traffic.algorithms.ground
Airport graphs
- class traffic.algorithms.ground.graphs.AirportGraph(graph, projection)
Create a graph from an airport.
- buffer_meter(shape, buffer=18)
Add a buffer around the geometric shape.
Useful to simulate for the width of taxiways. The buffer parameter is in meters.
- Return type:
BaseGeometry
- fix_airport_graph()
Builds an airport graph based on available information.
merge duplicate nodes
for each edge, detect every node that is geographically on the segment (linestring) and split the edge into two.
The resulting graph should be (at least very close to) a single connected component graph.
- Return type:
Self
- intersection_with_flight(flight)
Compute the intersection of a flight trajectory with all edges of the airport graph.
- Return type:
DataFrame
- make_parts(flight)
Make a table with statistics of the trajectory along the highlighted segments.
- Return type:
DataFrame
- map_flight(g)
Get the most probable path along edges with a pathfinding algorithm.
Returns segment one after the other.
- marker_edge(data, **kwargs)
Visualisation function to include edges on a Leaflet widget.
- Return type:
- merge_duplicate_nodes()
Relabel the graph to deal with nodes with identical coordinates.
This function helps rebuilding a topologically correct graph based on OpenStreetMap data.
Among the issues with raw OpenStreetMap data, we are bothered by few nodes which have a different id but the same coordinates.
- Return type:
Self
- snap_and_split(graph, u, v, k, tolerance)
Recursive companion function to split edges when an extra node is located on another edge, without being topologically connected.
u, v are the indices of the nodes
k is the key (because of the MultiGraph)
- tolerance (in m) allows snapping points that do not fall exactly on a
segment
- Return type:
- split_line_based_on_point(line, splitter)
Split a LineString with a Point
- Return type:
Kalman Filter with taxiway constraints
- class traffic.algorithms.ground.kalman_taxiway.KalmanTaxiway(airport, projection, closest=None, option='xs')
A Kalman filter that adds a contraint to snap a trajectory to documented taxiways of an airport.
- Parameters:
airport (
str) – The airport ICAO code to be considered.projection (
Projection) – A local projection used to compute x and y.
Movement detection
- class traffic.algorithms.ground.movement.StartMoving(speed_threshold=2, time_threshold='30s', filter_dict={'compute_gs': 3}, resample_rule='5s')
Returns the part of the trajectory after the aircraft starts moving.
Warning
This method has been extensively tested on aircraft taxiing before take-off. It should be adapted/taken with extra care for trajectories after landing.
- traffic.algorithms.ground.movement.mrr_diagonal(geom)
Returns the length of the diagonal of the minimum rotated rectangle around a given shape.
Consider using a
project_shape()method before applying this method if you need a distance in meters.- Return type:
Parking-position detection
- class traffic.algorithms.ground.parking_position.ParkingPositionGeometricIntersection(airport, buffer_size=1e-05, parking_positions=None)
Generates possible parking positions at a given airport.
- Parameters:
The algorithm looks at the intersection between the trajectory and a buffered version of the parking positions.
As a noisy trajectory may intersect several parking positions, it is recommended to use the max() method to select the trajectory segment with the longest duration.
Example usage:
>>> from traffic.data.samples import elal747 >>> parking = elal747.parking_position('LIRF').max() >>> parking.duration Timedelta('0 days 00:05:20') >>> parking.parking_position_max '702'
Warning
This method has been well tested for aircraft taking off, but should be double checked for landing trajectories.
Pushback detection
- class traffic.algorithms.ground.pushback.ParkingAreaBasedPushback(airport, stand_areas=None)
Returns the pushback part of the trajectory on ground.
The method identifies the start of the movement, an intersection with a documented apron area and the moment the aircraft suddenly changes direction in the computed track angle.
- Parameters:
>>> from traffic.data.samples import zurich_airport >>> flight = zurich_airport["AEE5ZH"] >>> pushback = flight.pushback('LSZH', method="parking_area") >>> pushback.duration Timedelta('0 days 00:04:26')
Warning
The method has poor performance when trajectory point on ground are lacking. This is often the case for data recorded from locations far from the airport.
- class traffic.algorithms.ground.pushback.ParkingPositionBasedPushback(airport, filter_dict={'compute_gs': 21, 'compute_track': 21, 'compute_track_unwrapped': 21}, track_threshold=90, parking_positions=None)
Returns the pushback part of the trajectory on ground.
The method identifies the start of the movement, the parking_position and the moment the aircraft suddenly changes direction in the computed track angle.
- Parameters:
>>> from traffic.data.samples import zurich_airport >>> flight = zurich_airport["AEE5ZH"] >>> pushback = flight.pushback('LSZH', method="parking_position") >>> pushback.duration Timedelta('0 days 00:01:45')
Warning
The method has poor performance when trajectory point on ground are lacking. This is often the case for data recorded from locations far from the airport.
Runway detection
- class traffic.algorithms.ground.runway.RunwayAlignment(airport, *, rwy_width_m=60.0, min_points=3, min_duration='5s', overlap_tolerance='1s')
Find trajectory segments aligned with airport runways.
Methodology (mirrors
Flight.aligned_on_runway()from the other project): - Build a flat-ended rectangle for each runway centerline using its truelength and the provided full width (meters).
Test each trajectory point for inclusion in the runway polygon (prepared geometry for speed).
Keep contiguous runs with at least
min_points; then drop runs shorter thanmin_duration.Merge overlapping/adjacent runs per runway within
overlap_tolerance.Yield flight segments annotated with
rwy(e.g.,"04/22").
Parameters
- airportstr | Airport
ICAO/IATA code or airport instance providing runway geometry.
- rwy_width_mfloat, default 60.0
Full runway width in meters used to build rectangular footprints.
- min_pointsint, default 3
Minimum consecutive trajectory points inside the runway polygon.
- min_durationtimedelta | str, default “5s”
Minimum segment duration after point filtering.
- overlap_tolerancetimedelta | str, default “1s”
Maximum gap when merging overlapping/adjacent runs per runway.
Notes
Both the point-count and duration thresholds must be satisfied for a segment to be yielded.