movingpandas.Trajectory.get_position_at#
- Trajectory.get_position_at(t, method='interpolated')#
Compute and return position at time t.
- Parameters:
t (datetime.datetime) – Timestamp to extract a row for
method (str) – Interpolation method
- Returns:
Position at time t
- Return type:
shapely Point
Examples
If the trajectory contains a position at the given timestamp, it is returned:
>>> traj.get_position_at(datetime(2018, 1, 1, 12, 6)) Point (6 0)
If there is no trajectory position for the given timestamp, the default behaviour is to interpolate the location:
>>> traj.get_position_at(datetime(2018, 1, 1, 12, 9)) POINT (6 4.5)
To get the trajectory position closest to the given timestamp, specify method=’nearest’:
>>> traj.get_position_at(datetime(2018, 1, 1, 12, 9), method='nearest') POINT (6 6)