traffic.core.airspace

class traffic.core.Airspace(name, elements, type_=None, designator=None, properties=None)

Bases: ShapelyMixin

property area: float

Returns the area of the shape, in square meters. The shape is projected to an equivalent local projection before computing a value.

property bounds: tuple[float, float, float, float]

Returns the bounds of the (bounding box of the) shape. Bounds are given in the following order in the origin crs: (west, south, east, north)

property centroid: Point

Returns the centroid of the shape as a shapely Point.

property extent: tuple[float, float, float, float]

Returns the extent of the (bounding box of the) shape.

Note

When plotting with Matplotlib and Cartopy, the extent property is convenient in the following use case:

>>> ax.set_extent(obj.extent)
Returns:

Extent is given in the following order in the origin crs: (west, east, south, north)

flatten()

Returns the 2D footprint of the airspace.

Return type:

Polygon

geoencode(**kwargs)

Returns an altair encoding of the shape to be composed in an interactive visualization. Specific plot features, such as line widths, can be passed with the kwargs argument. See documentation.

Return type:

LayerChart | Chart

geojson()

Returns the GeoJSON representation of the shape as a Dict. The transformation is delegated to shapely mapping method.

Return type:

dict[str, Any] | list[dict[str, Any]]

leaflet(**kwargs)

Returns a Leaflet layer to be directly added to a Map.

The elements passed as kwargs as passed as is to the Polygon constructor.

Return type:

Polygon

project_shape(projection=None)

Returns a projected representation of the shape.

Parameters:

projection (None | pyproj.Proj | ‘crs.Projection) – By default (None), an equivalent projection is applied. Equivalent projections locally respect areas, which is convenient for the area attribute.

Return type:

base.BaseGeometry