traffic
traffic copied to clipboard
Integration with lonboard
Hi @kylebarron,
edit: https://developmentseed.org/lonboard/latest/examples/air-traffic-control/
Could you have a look at this first tentative? If you have some feedback, better ideas?
I wrote some basic examples blocks below, maybe there are smarter things to do.
With lines, I often see glitches (spikes) that I don't get with other visualization methods. Maybe there's something wrong in my code...
- From lightest to heaviest, first a single trajectory:
from lonboard import Map, PathLayer, ScatterplotLayer
from traffic.data.samples import belevingsvlucht
table = belevingsvlucht.pyarrow_table(geo="line2d")
layer_traj = PathLayer(
table=table,
width_min_pixels=1,
get_color="#4c78a8",
)
layer_scat = ScatterplotLayer(
table=belevingsvlucht.next("holding_pattern").pyarrow_table(geo="point2d"),
radius_min_pixels=3,
get_fill_color="#f58518",
)
Map(layers=[layer_traj, layer_scat])
- From the same dataset as the quickstart example, I should do smarter things, but that's just a first shot:
from lonboard import Map, PathLayer, ScatterplotLayer
from traffic.data.samples import quickstart
lfpo_landing = PathLayer(
table=quickstart.filter("aggressive")
.resample("1s")
.has("aligned_on_ils('LFPO')")
.eval(desc="", max_workers=6)
.pyarrow_table(geo="line3d"),
width_min_pixels=1,
get_color="#4c78a8",
)
lfpg_landing = PathLayer(
table=quickstart.filter("aggressive")
.resample("1s")
.has("aligned_on_ils('LFPG')")
.eval(desc="", max_workers=6)
.pyarrow_table(geo="line3d"),
width_min_pixels=1,
get_color="#f58518",
)
Map(layers=[lfpo_landing, lfpg_landing])
- This is much heavier to preprocess (and there must be some settings to make it look beautiful)
# %%
from lonboard import Map, PathLayer, ScatterplotLayer
from traffic.data.datasets import landing_heathrow_2019
subset = (
# a bit long to process on a laptop, therefore limiting to 5000 flights
landing_heathrow_2019[:5000]
.label("holding_pattern", holding=True)
.eval(desc="", max_workers=4, cache_file="holding.parquet")
)
# %%
# Can we have a different color when the `holding` flag is True ?
holding_patterns = subset.query('holding').pyarrow_table(columns=["holding"], geo="point3d")
holding_layer = ScatterplotLayer(table=holding_patterns, radius_min_pixels=3)
Map(layers=[holding_layer])
Edit from a more powerful machine:
It looks like some paths are very well separated, i.e. runway threshold connected to beginning of trajectories sometimes.
With points and colors:
Apologies, I've been so busy lately. I'm trying to get a new release of lonboard out early next week and then hope to focus on the trips layer for the following release.
It looks like these examples are using data from the traffic library, right? So I should be able to easily reproduce them myself?
No worry, I also have a real job aside 😉
You should be able to run the code from traffic, but be careful to get it from the lonboard branch (attached to this PR) so you can get the pyarrow_table() methods (and few glitches fixed)
I will probably come with pathlayer() and scatterplotlayer() methods later after we converge.
Hi @kylebarron I see there have been some version update since our last discussion. Is there something related to our topic that I should be particularly aware of?
No not yet, but I have more time over the next few months to focus on Lonboard, so I'm motivated to push this over the line!