movingpandas.TrajectoryCollection.add_speed#
- TrajectoryCollection.add_speed(overwrite=False, name='speed', units=(None, None, None, None), n_processes=1, **kwargs)#
Add speed column and values to the trajectories.
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.
- Parameters:
overwrite (bool) – Whether to overwrite existing speed values (default: False)
name (str) – Name of the speed column (default: speed)
units (tuple(str)) –
Units in which to calculate speed
- distancestr
Abbreviation for the distance unit (default: CRS units, or metres if geographic)
- timestr
Abbreviation for the time unit (default: seconds)
For more info, check the list of supported units at https://movingpandas.org/units
n_processes (int or None, optional) – Number of processes to use for computation (default: 1). If set to None, the number of processes will be set to os.cpu_count(), enabling full CPU utilization via multiprocessing.
n_threads (int, optional) – DEPRECATED. Use n_processes instead. This parameter will be removed in a future version.
- Raises:
ValueError – If both n_processes and the deprecated n_threads are provided.