TrajectoryCollectionAggregator#

TrajectoryCollectionAggregator generalizes and aggregates trajectories by extracting clusters of significant trajectory points and computing flows between the clusters. It is based on an algorithm by Andrienko & Andrienko (2011) as described in https://anitagraser.com/2016/11/07/movement-data-in-gis-3-visualizing-massive-trajectory-datasets/.

class movingpandas.TrajectoryCollectionAggregator(traj_collection, max_distance, min_distance, min_stop_duration, min_angle=45)#
__init__(traj_collection, max_distance, min_distance, min_stop_duration, min_angle=45)#

Aggregates trajectories by extracting significant points, clustering those points, and extracting flows between clusters.

Parameters:
  • traj_collection (TrajectoryCollection) – TrajectoryCollection to be aggregated

  • max_distance (float) – Maximum distance between significant points (distance is calculated in CRS units, except if the CRS is geographic, e.g. EPSG:4326 WGS84, then distance is calculated in meters)

  • min_distance (float) – Minimum distance between significant points

  • min_stop_duration (datetime.timedelta) – Minimum duration required for stop detection

  • min_angle (float) – Minimum angle for significant point extraction

References

  • Andrienko, N., & Andrienko, G. (2011). Spatial generalization and aggregation of massive movement data. IEEE Transactions on visualization and computer graphics, 17(2), 205-219.

get_clusters_gdf()#

Return the extracted cluster centroids

Returns:

Cluster centroids, incl. the number of clustered significant points (n).

Return type:

GeoDataFrame

get_flows_gdf()#

Return the extracted flows

Returns:

Flow lines, incl. the number of trajectories summarized in the flow (weight) and the number of unique trajectory objects summarized in the flow (obj_weight).

Return type:

GeoDataFrame

get_significant_points_gdf()#

Return the extracted significant points

Returns:

Significant points

Return type:

GeoDataFrame