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

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

Abstract

Over the past decade, scientific studies have used the growing availability of large tracking datasets to enhance our understanding of human mobility behavior. However, so far data processing pipelines for the varying data collection methods are not standardized and consequently limit the reproducibility, comparability, and transferability of methods and results in quantitative human mobility analysis. This paper presents Trackintel, an open-source Python library for human mobility analysis. Trackintel is built on a standard data model for human mobility used in transport planning that is compatible with different types of tracking data. We introduce the main functionalities of the library that covers the full life-cycle of human mobility analysis, including processing steps according to the conceptual data model, read and write interfaces, as well as analysis functions (e.g., data quality assessment, travel mode prediction, and location labeling). We showcase the effectiveness of the Trackintel library through a case study with four different tracking datasets. Trackintel can serve as an essential tool to standardize mobility data analysis and increase the transparency and comparability of novel research on human mobility.

Introduction: The Need for Standardization

The explosion of digital tracking data—including GPS, mobile phone records, and location-based social networks—has revolutionized the study of human mobility. However, raw digital traces are rarely the direct unit of analysis. A single GPS coordinate does not inherently reveal whether a person is at work, waiting for a bus, or traveling home.

To bridge this gap, researchers typically develop custom, ad-hoc data processing pipelines to extract meaningful locations and trips. The absence of a standardized methodology means that different studies define and calculate these metrics inconsistently, making it nearly impossible to compare results across studies, reproduce findings, or transfer machine learning models to new datasets. While existing libraries for spatial data exist, they often lack the semantic hierarchy (activities, trips, tours) required for human transport planning.

The Trackintel Framework

Trackintel addresses this fragmentation by providing a unified framework for the full life-cycle of mobility data analysis. Built on top of the popular pandas and geopandas libraries, it integrates seamlessly into the modern Python data science ecosystem. The library provides a structured workflow from raw input data to high-level behavioral analysis.

Overview of the Trackintel framework, illustrating the pipeline from raw input data to the standardized data model and subsequent analysis functions.

A Hierarchical Data Model for Human Mobility

At the core of Trackintel is a hierarchical, activity-based data model widely used in transport planning. This model allows researchers to process data through a specific semantic hierarchy:

  1. Positionfix: Raw, timestamped location data (e.g., a GPS ping).
  2. Staypoint: A location where a user remains stationary for a defined duration (e.g., waiting for a train or being at an office).
  3. Tripleg: Continuous movement without changing the mode of transport (e.g., a single bus ride).
  4. Trip: The total travel between two significant activities (e.g., walking to the bus, riding the bus, and walking to the office).
  5. Tour: A sequence of trips that start and end at the same location (e.g., Home -> Work -> Cafe -> Home).
  6. Location: Spatially aggregated staypoints representing places significant to the user.
The hierarchical data model used by Trackintel, showing the relationship between raw positionfixes and higher-level semantic concepts like trips and tours.

Trackintel provides built-in algorithms to generate these levels, such as sliding window algorithms for staypoints and DBSCAN for location clustering. It also includes tools to impute transport modes and identify "home" and "work" locations based on temporal patterns.

Case Study: Validating Across Diverse Datasets

To demonstrate the library's versatility, the authors processed four distinct tracking datasets:

  • Geolife: Open-source GPS data from Microsoft Research Asia employees using dedicated trackers.
  • SBB Green Class 1 & 2: Studies by Swiss Federal Railway Systems using a smartphone GNSS app, where participants used public transport alongside e-cars or e-bikes.
  • Yumuv: A study of a Mobility-as-a-Service (MaaS) app integrating shared e-scooters, e-bikes, and public transport.

Key Insights and Results

By standardizing these diverse datasets, Trackintel enabled direct behavioral comparisons. The framework successfully processed over 1.1 million triplegs and 769,000 staypoints. Quantitative analysis revealed that SBB Green Class 1 users were highly active, averaging 4.32 trips per day with an average trip distance of 27.4 km. In contrast, Geolife users averaged only 1.70 trips per day, a result heavily influenced by lower tracking quality and frequent signal gaps in dedicated GPS hardware compared to modern smartphone apps.

Furthermore, the library's modal split visualizations highlighted the dominance of "slow" mobility (walking/scooters) in the Yumuv dataset compared to the motorized/fast mobility dominance in the Green Class datasets. This demonstrates how standardization unlocks the ability to spot true behavioral differences rather than artifacts of different processing pipelines.

Limitations and Future Outlook

Currently, Trackintel's analysis functions, such as transport mode prediction, rely on simple heuristics (e.g., speed thresholds) rather than complex deep learning models. This is an intentional design choice to ensure broad compatibility across datasets that may lack specialized features like accelerometer data. Future development will focus on incorporating more robust processing algorithms, such as map matching, and expanding the library's suite of preprocessing and visualization options while maintaining strict open-source standards.

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