MovingPandas.TrajectoryGeneralizer

movingpandas: Implementation of Trajectory classes and functions built on top of GeoPandas

class movingpandas.TrajectoryGeneralizer(traj)

Generalizer base class

__init__(traj)

Create TrajectoryGeneralizer

Parameters:traj (Trajectory or TrajectoryCollection) –
generalize(tolerance)

Generalize the input Trajectory/TrajectoryCollection.

Parameters:tolerance (any type) – Tolerance threshold, differs by generalizer
Returns:Generalized Trajectory or TrajectoryCollection
Return type:Trajectory/TrajectoryCollection
class movingpandas.DouglasPeuckerGeneralizer(traj)

Generalizes using Douglas-Peucker algorithm.

tolerance : float
Distance tolerance

Examples

>>> mpd.DouglasPeuckerGeneralizer(traj).generalize(tolerance=1.0)
class movingpandas.MinDistanceGeneralizer(traj)

Generalizes based on distance.

This generalization ensures that consecutive locations are at least a certain distance apart.

tolerance : float
Desired minimum distance between consecutive points

Examples

>>> mpd.MinDistanceGeneralizer(traj).generalize(tolerance=1.0)
class movingpandas.MinTimeDeltaGeneralizer(traj)

Generalizes based on time.

This generalization ensures that consecutive rows are at least a certain timedelta apart.

tolerance : datetime.timedelta
Desired minimum time difference between consecutive rows

Examples

>>> mpd.MinTimeDeltaGeneralizer(traj).generalize(tolerance=timedelta(minutes=10))