MovingPandas.TrajectoryStopDetector#
movingpandas: Implementation of Trajectory classes and functions built on top of GeoPandas
- class movingpandas.TrajectoryStopDetector(traj, n_threads=1)#
Detects stops in a trajectory. A stop is detected if the movement stays within an area of specified size for at least the specified duration.
- __init__(traj, n_threads=1)#
Create StopDetector
- Parameters:
traj (Trajectory or TrajectoryCollection)
n_threads (number of threads to use for computation (default: 1))
- get_stop_points(max_diameter, min_duration)#
Returns detected stop location points
- Parameters:
max_diameter (float) – Maximum diameter for stop detection
min_duration (datetime.timedelta) – Minimum stop duration
- Returns:
Stop locations as points with start and end time and stop duration in seconds
- Return type:
geopandas.GeoDataFrame
Examples
>>> detector = mpd.TrajectoryStopDetector(traj) >>> stops = detector.get_stop_points(min_duration=timedelta(seconds=60), max_diameter=100)
- get_stop_segments(max_diameter, min_duration)#
Returns detected stop trajectory segments
- Parameters:
max_diameter (float) – Maximum diameter for stop detection
min_duration (datetime.timedelta) – Minimum stop duration
- Returns:
Trajectory segments
- Return type:
Examples
>>> detector = mpd.TrajectoryStopDetector(traj) >>> stops = detector.get_stop_segments(min_duration=timedelta(seconds=60), max_diameter=100)
- get_stop_time_ranges(max_diameter, min_duration)#
Returns detected stop start and end times
- Parameters:
max_diameter (float) – Maximum diameter for stop detection
min_duration (datetime.timedelta) – Minimum stop duration
- Returns:
TemporalRanges of detected stops
- Return type:
list