transbigdata.traj_segment

transbigdata.traj_segment(data, groupby_col=['id', 'moveid'], retain_col=['time', 'lon', 'lat'])

Segment the trajectory in order and return the starting and ending information of each segment. This function can segment GPS trajectory data, calculate the start and end information of each segment, and store the results in a DataFrame object. The input of this function includes a pandas DataFrame object containing GPS trajectory data, field names for grouping, and field names to be retained. The output is a pandas DataFrame object containing the starting and ending information of each segment, where each row represents a trajectory segment.

Parameters:
  • data (DataFrame) – The trajectory data needs to be sorted beforehand.

  • groupby_col (List) – A list of strings specifying the groupby fields to be used for segmentation.

  • retain_col (List) – A list of strings specifying the fields to be retained.

Returns:

data – Containing the starting and ending information of each segment, where each row represents a trajectory segment.

Return type:

DataFrame