Trackintel: An open-source Python library for human mobility analysis

Henry Martin, Ye Hong, Nina Wiedemann, Dominik Bucher, Martin Raubal

TL;DR

This paper introduces Trackintel, a new open-source Python library designed to standardize the processing and analysis of human mobility data. By implementing a widely accepted conceptual data model and providing a comprehensive set of tools, Trackintel aims to improve the reproducibility, comparability, and transferability of research in this rapidly growing field.

What Problem Does This Paper Address?

The study of human mobility using digital traces has exploded in recent years, revealing universal patterns in movement. However, the diverse nature of tracking data (e.g., GPS, mobile phone records, check-ins) and the lack of standardized preprocessing pipelines have made it difficult to compare results across studies. This fragmentation limits reproducibility and hinders the development of robust, generalizable methods for analyzing human mobility. Researchers often have to reinvent the wheel for data cleaning and preparation, leading to inconsistencies and a lack of transparency.

Methods

Trackintel addresses this by providing a unified framework built around a hierarchical data model for human mobility, inspired by established concepts in transport planning. This model includes classes for positionfix, staypoint, tripleg, trip, tour, and location, representing movement at different semantic levels. The library offers functionalities for:

  • Import/Export: Reading data from various sources like CSV, GeoDataFrames, PostGIS, and specific public datasets.
  • Preprocessing: Generating the core data model components from raw data, including staypoint detection (using a sliding window algorithm with gap handling), location aggregation (using DBSCAN), and trip generation from staypoints and triplegs.
  • Analysis: Performing tasks like transport mode labeling (based on speed heuristics), home/work location identification (using an adapted OSNA algorithm), modal split calculation, and temporal tracking quality assessment.
  • Visualization: Plotting different data types (positionfixes, staypoints, triplegs) and modal split results.

The library is implemented in Python and leverages Pandas and GeoPandas for efficient data handling, making it easily integrable with other Python spatial analysis tools.

Datasets

The paper presents a case study using four distinct datasets to demonstrate Trackintel's capabilities:

  • Geolife dataset: Open-source GPS tracker data from Microsoft Research Asia employees.
  • SBB Green Class 1: Data from participants with access to public transport and an electric vehicle, tracked via the Myway app.
  • SBB Green Class 2: Data from participants with access to public transport and an e-bike, also tracked via the Myway app.
  • yumuv study: Data from a Mobility-as-a-Service app study involving shared e-scooters, e-bikes, and public transport.

These datasets vary in tracking method (GPS tracker vs. smartphone app), data granularity (positionfixes vs. pre-processed staypoints/triplegs), and study duration/participant numbers.

Key Insights and Ideas

  • Standardization is Crucial: The core idea is that a standardized data model and preprocessing pipeline are essential for advancing human mobility research, enabling better reproducibility and comparability.
  • Hierarchical Model: The hierarchical data model effectively captures different levels of semantic detail in human movement, from raw GPS points to aggregated trips and tours.
  • Flexibility in Input: Trackintel can ingest data at various levels of preprocessing, accommodating diverse data sources without requiring users to start from raw positionfixes.
  • Cross-Dataset Comparability: The library's standardized approach allows for meaningful comparisons of mobility patterns, tracking quality, and modal splits across datasets with different characteristics.
  • Heuristics for Analysis: While aiming for standardization, Trackintel also incorporates heuristic-based analysis functions (like mode labeling) that can be useful even without extensive user-provided labels or sensor data.

Key Results

The case study demonstrated Trackintel's ability to process and compare four diverse datasets. Key findings included:

  • Tracking Quality Variation: Geolife data showed significant individual differences in temporal tracking quality, likely due to older GPS-only hardware, while smartphone-tracked data (Green Class, yumuv) exhibited higher and more consistent quality.
  • Trip Behavior Differences: Participants in Green Class 1 and 2 were more active in conducting trips, while yumuv and Geolife users took longer trips on average. Yumuv trips were shorter in distance, reflecting urban environments.
  • Modal Split Diversity: Modal splits varied considerably, influenced by study design (e.g., full public transport access for Green Class) and user context (e.g., urban living for yumuv).
  • Activity Patterns: Home and work location identification was successful, though the accuracy for Geolife was potentially impacted by its lower tracking quality.

Limitations and Future Work

The authors acknowledge that the heuristic-based analysis functions, such as transport mode prediction, are simple and may not be as sophisticated as dataset-specific methods. However, they emphasize that Trackintel's strength lies in providing a robust framework for preprocessing and standardization, allowing users to integrate more advanced, custom analysis modules.

Future work will focus on:

  • Incorporating more advanced processing and analysis algorithms.
  • Offering a wider range of options for preprocessing, analysis, and visualization.
  • Continuously extending the library to support new data types and analytical needs.
  • Maintaining strong compatibility with the Python data science ecosystem (Pandas, GeoPandas) to facilitate integration into larger workflows.

Summary updated

BibTeX
@article{martin2023trackintel,
  author = {Henry Martin and Ye Hong and Nina Wiedemann and Dominik Bucher and Martin Raubal},
  title = {{Trackintel: An open-source Python library for human mobility analysis}},
  journal = {Comput. Environ. Urban Syst.},
  year = {2023},
  doi = {10.1016/j.compenvurbsys.2023.101938},
}
Figure