Py.Cafe

NAjamsher/

us-airports-map-visualization

US Airports Map Visualization

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import solara
import altair as alt
from vega_datasets import data

@solara.component
def AirportMap():
    airports = data.airports()

    chart = alt.Chart(airports).mark_circle().encode(
        longitude='longitude:Q',
        latitude='latitude:Q',
        size=alt.value(10),
        tooltip='name'
    ).project(
        "albersUsa"
    ).properties(
        width=500,
        height=400
    )

    return solara.FigureAltair(chart)

@solara.component
def Page():
    with solara.Column():
        solara.Title("US Airports Map")
        AirportMap()

# This is only needed if you run this script directly (python app.py)
# When importing this file, this code will not run.
if __name__ == "__main__":
    Page()