Plugins

We can export traffic structures to different visualisation tools. We use here the data produced on the Quickstart page.

from traffic.data.samples import quickstart

def landing_trajectory(flight: "Flight") -> bool:
    return (
        flight.min("altitude") < 10_000 and
        flight.mean("vertical_rate") < -500
    )

demo = (
    quickstart
    # non intersecting flights are discarded
    .intersects(lfbo_tma)
    # intersecting flights are filtered
    .filter()
    # filtered flights not matching the condition are discarded
    .filter_if(landing_trajectory)
    # stay below 25000ft
    .query('altitude < 25000')
    # final multiprocessed evaluation (4 cores) through one iteration
    .eval(max_workers=4)
)

Leaflet

Leaflet offer a Python widget for Jupyter Lab. Flights and Airspaces can easily be plotted into such widgets. The Traffic extracted above can be conveniently explored in the following widget.

Just for fun, you can zoom up to the airport level and check the runway used for landing.

from ipyleaflet import Map, basemaps
from ipywidgets import Layout

map_ = Map(
    center=(43.5, 1.5),
    zoom=7,
    basemap=basemaps.Stamen.Terrain,
    layout=Layout(width="100%", max_width="800px", height="500px"),
)

map_.add_layer(nm_airspaces["LFBOTMA"])
for flight in demo:
    map_.add_layer(flight, color="#990000", weight=2)

map_

CesiumJS

CesiumJS is a great tool for displaying and animating geospatial 3D data. The library provides an export of a Traffic structure to a czml file. A copy of this file is available in the data/ directory. You may drag and drop it on the http://cesiumjs.org/ page after you open it on your browser.

demo.to_czml('data/sample_cesium.czml')