MovingPandas.TrajectorySplitter#

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

class movingpandas.TrajectorySplitter(traj)#

Splitter base class

__init__(traj)#

Create TrajectoryGeneralizer

Parameters:

traj (Trajectory or TrajectoryCollection)

split(**kwargs)#

Split the input Trajectory/TrajectoryCollection.

Parameters:

kwargs (any type) – Split parameters, differs by splitter

Returns:

Split trajectories

Return type:

TrajectoryCollection

class movingpandas.TemporalSplitter(traj)#

Split trajectories into subtrajectories using regular time intervals.

Parameters:
  • mode (str) – Split mode. (hour, day, month or year)

  • min_length (numeric) – Desired minimum length of trajectories. (Shorter trajectories are discarded.)

Examples

>>> mpd.TemporalSplitter(traj).split(mode="year")
class movingpandas.ObservationGapSplitter(traj)#

Split trajectories into subtrajectories whenever there is a gap in the observations.

Parameters:
  • gap (datetime.timedelta) – Time gap threshold

  • min_length (numeric) – Desired minimum length of trajectories. Shorter trajectories are discarded. (Length is calculated using CRS units, except if the CRS is geographic (e.g. EPSG:4326 WGS84) then length is calculated in metres.)

Examples

>>> mpd.ObservationGapSplitter(traj).split(gap=timedelta(hours=1))
class movingpandas.SpeedSplitter(traj)#

Split trajectories if there are no speed measurements above the speed limit for the specified duration.

Parameters:
  • speed (float) – Speed limit

  • duration (datetime.timedelta) – Minimum stop duration

  • min_length (numeric) – Desired minimum length of trajectories. Shorter trajectories are discarded. (Length is calculated using CRS units, except if the CRS is geographic (e.g. EPSG:4326 WGS84) then length is calculated in metres.)

  • max_speed (float) – Max speed limit (Speed is calculated as CRS units per second, except if the CRS is geographic (e.g. EPSG:4326 WGS84) then speed is calculated in meters per second.)

Examples

>>> mpd.SpeedSplitter(traj).split(speed=10, duration=timedelta(minutes=5))
class movingpandas.StopSplitter(traj)#

Split trajectories at detected stops. A stop is detected if the movement stays within an area of specified size for at least the specified duration.

Parameters:
  • max_diameter (float) – Maximum diameter for stop detection

  • min_duration (datetime.timedelta) – Minimum stop duration

  • min_length (numeric) – Desired minimum length of trajectories. Shorter trajectories are discarded. (Length is calculated using CRS units, except if the CRS is geographic (e.g. EPSG:4326 WGS84) then length is calculated in metres.)

Examples

>>> mpd.StopSplitter(traj).split(max_diameter=7, min_duration=timedelta(seconds=60))