Integration with GeoArrow and Lonboard for large-scale interactive visualization/animation #414
Replies: 1 comment 29 replies
-
Hello @kylebarron I am quite interested with your project, looks really cool! So there's a reason why I am not using the geopandas from the start. That's a question I asked myself early on and the thing is that:
So in traffic paradigm, a trajectory is not a line in a dataframe but a sub-dataframe. I have some functions to iterate over flights, and the Does it help? Side note about Rust: I am interested too! For now, I am basically serializing vectors of JSON through pickle when passing decoded messages from Rust to Python, but it's not ideal... (I am new to Rust, this is my first project!) Considering my comment above I am not sure it would fit well though, but will have a look. About what I read here wouldn't it be a smarter move to stick to a full Rust (more simple) implementation like https://github.com/busstoptaktik/geodesy/ ? # %%
import geopandas as gpd
from traffic.data.datasets import landing_zurich_2019
summary = (
landing_zurich_2019.resample("10s")
.summary(["start", "stop", "callsign", "icao24", "linestring"])
.eval(desc="", max_workers=4)
)
gdf = gpd.GeoDataFrame(summary.rename(columns=dict(linestring="geometry")))
# %%
from lonboard import viz
viz(gdf) |
Beta Was this translation helpful? Give feedback.
-
👋 This is a really cool library, and I wonder if there might be some mutual benefit to integrating our work!
In the quickstart you note
ipyleaflet indeed is not very performant. I've been working on an open source library called Lonboard which connects to deck.gl. By using Arrow and Parquet efficiently, it can render ~3 million coordinates in an interactive map from Python in a few seconds.
deck.gl was originally built by Uber and since they also wanted to visualize large numbers of moving objects, the JS library includes a
TripsLayer
that animates moving objects (example, note that reducing the "trail" slider on the right makes each trajectory clearer).I've started but haven't yet finished a PR that connects this to Python. That PR's description has a screen recording of an example animation from ship AIS data, but I think air traffic data would make a really compelling demo. With that PR you should be able to render trajectories containing 3 million coordinates, and ideally be able to set a different color per coordinate based on some attribute like current speed.
Under the hood, Lonboard works by converting data to the GeoArrow data format, which for an array of LineStrings is essentially raw arrays of coordinates for the entire column plus an offset array to determine at which indices each LineString starts and ends. So what I'd need to implement is the adapter from a
Traffic
object to apyarrow.Table
with timestamps at the same level of nesting as the LineString column.Side note: I see in https://github.com/xoolive/rs1090 one of the goals is "exporting trajectory data to cross-platform formats such as JSON or parquet". You might be interested in using (Geo)Arrow for this, which would allow for sharing large data between Rust and Python without copies. I'm building a Rust-Python (and Rust-Wasm) library for GeoArrow that benefits from being able to move Arrow data between Rust and Python for free.
Do you think this kind of integration makes sense? Is this interesting? If so, is there a data source to play with that contains multiple flights at the same time in the same airspace? I'm thinking something like a 30-minute window of flights in congested airspace like NYC would make for a really cool visualization. I haven't yet figured out a good way to access data like that though.
Beta Was this translation helpful? Give feedback.
All reactions