Plot only trajectory segments exceeding length threshold

Given a Pandas DataFrame with millions of location records (lat and lon column) for multiple moving objects, is there an elegant way to plot only segments (connecting consecutive location records of the same moving object) that exceed a certain minimum length?

https://datashader.org/user_guide/Trajectories.html does not go into much detail and any styling I apply to the path (as described in http://holoviews.org/reference/elements/matplotlib/Path.html) gets lost during datashading.

I can achieve the desired results using GeoPandas & geoviews but it’s rather slow.

I’ve worked out a work-around: see section A-5) Gaps in trajectories in https://github.com/anitagraser/movingpandas-examples/blob/main/analysis-examples/5-exploration-protocol.ipynb but it’s quite tedious and I wonder if I’m missing anything.

1 Like