traffic/plugins/leaflet.py
def airspace_leaflet(airspace: "Airspace", **kwargs) -> Polygon:
    """Returns a Leaflet layer to be directly added to a Map.

    .. warning::
        This is only available if the Leaflet `plugin <plugins.html>`_ is
        activated. (true by default)

    The elements passed as kwargs as passed as is to the Polygon constructor.
    """
    shape = airspace.flatten()

    kwargs = {**dict(weight=3), **kwargs}
    coords: List[Any] = []
    if shape.geom_type == "Polygon":
        coords = list((lat, lon) for (lon, lat, *_) in shape.exterior.coords)
    else:
        coords = list(
            list((lat, lon) for (lon, lat, *_) in piece.exterior.coords)
            for piece in shape
        )

    return Polygon(locations=coords, **kwargs)
Returns a Leaflet layer to be directly added to a Map.

    .. warning::
        This is only available if the Leaflet `plugin <plugins.html>`_ is
        activated. (true by default)

    The elements passed as kwargs as passed as is to the Polygon constructor.
    
Returns a Leaflet layer to be directly added to a Map.
warning::
This is only available if the Leaflet `plugin `_ is
activated. (true by default)

The elements passed as kwargs as passed as is to the Polygon constructor.
Returns a Leaflet layer to be directly added to a Map . warning :: This is only available if the Leaflet ` plugin ` _ is activated . ( true by default ) The elements passed as kwargs as passed as is to the Polygon constructor .
def airspace_leaflet(airspace: "Airspace", **kwargs) -> Polygon:
    shape = airspace.flatten()
    kwargs = {**dict(weight=3), **kwargs}
    coords: List[Any] = []
    if shape.geom_type == "Polygon":
        coords = list((lat, lon) for (lon, lat, *_) in shape.exterior.coords)
    else:
        coords = list(
            list((lat, lon) for (lon, lat, *_) in piece.exterior.coords)
            for piece in shape
        )
    return Polygon(locations=coords, **kwargs)
def airspace_leaflet ( airspace : "Airspace" , ** kwargs ) -> Polygon : shape = airspace . flatten ( ) kwargs = { ** dict ( weight = 3 ) , ** kwargs } coords : List [ Any ] = [ ] if shape . geom_type == "Polygon" : coords = list ( ( lat , lon ) for ( lon , lat , * _ ) in shape . exterior . coords ) else : coords = list ( list ( ( lat , lon ) for ( lon , lat , * _ ) in piece . exterior . coords ) for piece in shape ) return Polygon ( locations = coords , ** kwargs )
Returns a Leaflet layer to be directly added to a Map.
Returns a Leaflet layer to be directly added to a Map .
"""Returns a Leaflet layer to be directly added to a Map.

    .. warning::
        This is only available if the Leaflet `plugin <plugins.html>`_ is
        activated. (true by default)

    The elements passed as kwargs as passed as is to the Polygon constructor.
    """
airspace
"Airspace"