Package: trackintel
The trackintel frameworktrackintelis a library for the analysis of spatio-temporal tracking data with a focus on human mobility. The core oftrackintelis the hierarchical data model for movement data that is used in GIS, transport planning and related fields. We provide functionalities for the full life-cycle of human mobility data analysis: import and export of tracking data of different types (e.g, trackpoints, check-ins, trajectories), preprocessing, data quality assessment, semantic enrichment, quantitative analysis and mining tasks, and visualization of data and results.
Trackintel is based onPandasandGeoPandas.You can find the documentation on thetrackintel documentation page.Trytrackintelonline in a MyBinder notebook:Please star this repo andciteour paper if you find our work is helpful for you.Data modelAn overview of the data model oftrackintel:positionfixes(Raw tracking points, e.g., GPS recordings or check-ins)staypoints(Locations where a user spent time without moving, e.g., aggregations of positionfixes or check-ins). Staypoints can be classified into the following categories:activitystaypoints. Staypoints with a purpose and a semantic label, e.g., stopping at a cafe to meet with friends or staying at the workplace.non-activity staypoints. Staypoints without an explicit purpose, e.g., waiting for a bus or stopping in a traffic jam.locations(Important places that are visited more than once, e.g., home or work location)triplegs(or stages) (Continuous movement without changing mode, vehicle or stopping for too long, e.g., a taxi trip between pick-up and drop-off)trips(The sequence of all triplegs between two consecutive activity staypoints)tours(A collection of sequential trips that return to the same location)An example plot showing the hierarchy of thetrackinteldata model can be found below:The image below explicitly shows the definition oflocationsas clusteredstaypoints, generated by one or several users.You can enter thetrackintelframework if your data corresponds to any of the above mentioned movement data representation. Here are some of the functionalities that we provide:Import: Import from the following data formats is supported:geopandas dataframes(recommended),csv filesin a specified format,postGISdatabases. We also provide specific dataset readers for popular public datasets (e.g, geolife).Aggregation: We provide functionalities to aggregate into the next level of our data model. E.g., positionfixes→staypoints; positionfixes→triplegs; staypoints→locations; staypoints+triplegs→trips; trips→toursEnrichment: Activity semantics for staypoints; Mode of transport semantics for triplegs; High level semantics for locationsHow it workstrackintelprovides support for the full life-cycle of human mobility data analysis.[1.]Import data.importgeopandasasgpdimporttrackintelasti# read pfs from csv filepfs=ti.io.read_positionfixes_csv(".\examples\data\pfs.csv",sep=";",index_col="id")# or with predefined dataset readers (here geolife)pfs,_=ti.io.read_geolife(".\tests\data\geolife_long")[2.]Data model generation.# generate staypoints and triplegspfs,sp=pfs.generate_staypoints(method='sliding')pfs,tpls=pfs.generate_triplegs(sp,method='between_staypoints')[3.]Visualization.# plot the generated tripleg resultti.plot(positionfixes=pfs,staypoints=sp,triplegs=tpls,radius_sp=10)[4.]Analysis.# e.g., predict travel mode labels based on travel speedtpls=tpls.predict_transport_mode()# or calculate the temporal tracking coverage of userstracking_coverage=ti.temporal_tracking_quality(tpls,granularity='all')[5.]Save results.# save the generated results as csv filesp.to_csv(r'.\examples\data\sp.csv')tpls.to_csv(r'.\examples\data\tpls.csv')For example, the plot below shows the generated staypoints and triplegs from the imported raw positionfix data.Installation and Usagetrackintelis onpypi.organdconda-forge. We recommend installing trackintel via conda-forge:conda install -c conda-forge trackintelAlternatively, you can install it with pip in aGeoPandasavailable environment using:pip install trackintelYou should then be able to run the examples in theexamplesfolder or import trackintel using:import trackintel as ti

ti.print_version()Requirements and dependenciesNumpyGeoPandasMatplotlibPintNetworkXGeoAlchemy2scikit-learntqdmOSMnxsimilaritymeasuresDevelopmentYou can find the development roadmap underROADMAP.mdand further development guidelines underCONTRIBUTING.md.Contributorstrackintelis primarily maintained by the Mobility Information Engineering Lab at ETH Zurich (mie-lab.ethz.ch).
If you want to contribute, send a pull request and put yourself in theAUTHORS.mdfile.CitationIf you find this code useful for your work or use it in your project, please consider citing:Martin, H., Hong, Y., Wiedemann, N., Bucher, D., & Raubal, M. (2023).Trackintel: An open-source Python library for human mobility analysis. Computers, Environment and Urban Systems, 101, 101938.@article{Martin_2023_trackintel,
  doi = {10.1016/j.compenvurbsys.2023.101938},
  volume = {101},
  pages = {101938},
  author = {Henry Martin and Ye Hong and Nina Wiedemann and Dominik Bucher and Martin Raubal},
  keywords = {Human mobility analysis, Open-source software, Transport planning, Data mining, Python, Tracking studies},
  title = {Trackintel: An open-source Python library for human mobility analysis},
  journal = {Computers, Environment and Urban Systems},
  year = {2023},
}