movingpandas: Implementation of Trajectory classes and functions built on top of GeoPandas
- class movingpandas.TrajectoryGeneralizer(traj)¶
Generalizer base class
Generalize the input Trajectory/TrajectoryCollection.
tolerance (any type) – Tolerance threshold, differs by generalizer
Generalized Trajectory or TrajectoryCollection
- Return type
- class movingpandas.DouglasPeuckerGeneralizer(traj)¶
Generalizes using Douglas-Peucker algorithm (as implemented in shapely/Geos).
Distance tolerance in trajectory CRS units
Douglas, D., & Peucker, T. (1973). Algorithms for the reduction of the number of points required to represent a digitized line or its caricature. The Canadian Cartographer 10(2), 112–122. doi:10.3138/FM57-6770-U75U-7727.
- class movingpandas.MinDistanceGeneralizer(traj)¶
Generalizes based on distance.
This generalization ensures that consecutive locations are at least a certain distance apart.
Distance is calculated using CRS units, except if the CRS is geographic (e.g. EPSG:4326 WGS84) then distance is calculated in metres.
Desired minimum distance between consecutive points
- class movingpandas.MinTimeDeltaGeneralizer(traj)¶
Generalizes based on time.
This generalization ensures that consecutive rows are at least a certain timedelta apart.
Desired minimum time difference between consecutive rows
- class movingpandas.TopDownTimeRatioGeneralizer(traj)¶
Generalizes using Top-Down Time Ratio algorithm proposed by Meratnia & de By (2004).
This is a spatiotemporal trajectory generalization algorithm. Where Douglas-Peucker simply measures the spatial distance between points and original line geometry, Top-Down Time Ratio (TDTR) measures the distance between points and their spatiotemporal projection on the trajectory. These projections are calculated based on the ratio of travel times between the segment start and end times and the point time.
Distance tolerance (distance returned by shapely Point.distance function)
Meratnia, N., & de By, R.A. (2004). Spatiotemporal compression techniques for moving point objects. In International Conference on Extending Database Technology (pp. 765-782). Springer, Berlin, Heidelberg.