Gaining insights from trajectory datasets is a challenging task that requires suitable visual data representations. There is a considerable gap between the state of the art cartographic techniques presented in the literature and currently available spatial data science toolboxes. This talk presents the current state of geospatial visualization tools for trajectory data, focusing on the Python and Jupyter notebooks ecosystem. The identified shortcomings provide pointers for further scientific software development, as well as a reference for data scientists that helps to pick the best fitting tool for a specific job.
1. THE STATE OF TRAJECTORY VISUALIZATION
IN NOTEBOOK ENVIRONMENTS
GI_Salzburg, 2022-07-07
Anita Graser
@underdarkGIS
2.
3. Accept messiness in data
Need to understand
Causes of bias & messiness
Consequences of using such data
in analyses
Data visualization & exploratory
approaches
CHALLENGES
Brunsdon & Comber (2020) Big issues for big data Graser & Dragaschnig (2020) Open Geospatial Tools for Movement Data Exploration
4. REALITY CHECK
Graser et al. (2020) Exploratory Trajectory Analysis for Massive Historical AIS Datasets
5. REALITY CHECK
Andrienko et al. (2016) Understanding movement data quality. Journal of Location Based Services.
7. Python
PyMove: Python library to simplify queries and visualization of
trajectories and other spatial-temporal data. (first GH commit: 2018-
09-09)
MovingPandas: Trajectory classes and functions built on top of
GeoPandas. (first GH commit: 2018-12-16)
Traja: Python tools for 2D spatial trajectory data. (first GH commit:
2019-01-13)
trackintel: a framework for spatio-temporal analysis of
movement trajectory and mobility data. (first GH commit: 2019-01-20)
scikit-mobility: Mobility analysis in Python. (first GH commit: 2019-
04-28)
MovinPy: Process and analyze mobility data. (first GH commit:
2020-07-23)
HuMobi: a library for human mobility analyses implemented in
Python. (first GH commit: 2021-06-02)
PTRAIL: parallel computation library for Mobility Data
Preprocessing and feature generation. (first GH commit: 2021-05-31)
TransBigData: transportation spatio-temporal big data
processing, analysis and visualization. (first GH commit: 2021-10-17)
MOVEMENT ANALYSIS TOOLS
C++
Tracktable (with Python API): moving object trajectory
analysis in C++ and Python. (first GH commit: 2016-
04-10)
MEOS (with Python API): Mobility Engine, Open
Source is a C++ library which makes it easy to work
with temporal and spatio-temporal data. (first GH
commit: 2020-04-19)
MoveTK: a library for computational movement
analysis written in C++. (first GH commit: 2020-09-09)
R
Review paper: Joo, R., Boone, M. E., Clay, T. A.,
Patrick, S. C., Clusella‐Trullas, S., & Basille, M. (2020).
Navigating through the R packages for movement.
Journal of Animal Ecology, 89(1), 248-267.
Databases
MobilityDB: A geospatial trajectory data management
& analysis platform, built on PostgreSQL and PostGIS.
(first GH commit: 2019-02-17)
mobilitydb-python: Python driver for MobilityDB.
mobilitydb-sqlalchemy: MobilityDB extensions for
SQLAlchemy
https://github.com/anitagraser/movement-analysis-tools
8. Pandas
… developed in the context of financial modeling
extensive set of tools for working with dates, times,
and time-indexed data
GeoPandas
… extends the datatypes used by Pandas to allow spatial
operations on geometric types
WHY PANDAS?
https://anitagraser.com/2018/11/18/movement-data-in-gis-16-towards-pure-python-trajectories-using-geopandas/
9. Visualization library
PyMove Folium
MovingPandas GeoViews & Matplotlib
Traja Matplotlib
Trackintel Matplotlib
Scikit-mobility Folium
PTRAIL Folium
TransBigData Kepler.GL
WHAT ABOUT VISUALIZATIONS?
Folium
10. Data: “Heterogeneous Integrated Dataset for Maritime Intelligence, Surveillance, and Reconnaissance" (Ray et al. 2018).
✅ Interactive plot
✅ Background maps
✅ Object identity
⏹⏹
Direction
⏹⏹
Speed
🆘 Time
11. Data: “Heterogeneous Integrated Dataset for Maritime Intelligence, Surveillance, and Reconnaissance" (Ray et al. 2018).
✅ Interactive plot
✅ Background maps
⏹⏹
Object identity
⏹⏹
Direction
✅ Speed
🆘 Time
12. Data: “Heterogeneous Integrated Dataset for Maritime Intelligence, Surveillance, and Reconnaissance" (Ray et al. 2018).
✅ Interactive plot
✅ Background maps
✅ Object identity
⏹⏹
Direction
🆘 Speed
🆘 Time
Folium
13. Data: “Heterogeneous Integrated Dataset for Maritime Intelligence, Surveillance, and Reconnaissance" (Ray et al. 2018).
🆘 Static plot
⏹⏹
Only OSM network plot
✅ Object identity
🆘 Direction
🆘 Speed
🆘 Time
14. Data: “Heterogeneous Integrated Dataset for Maritime Intelligence, Surveillance, and Reconnaissance" (Ray et al. 2018).
🆘 Static plot
🆘 No background maps
🆘 Object identity
⏹⏹
Direction
🆘 Speed
✅ Time
15. Data: “Heterogeneous Integrated Dataset for Maritime Intelligence, Surveillance, and Reconnaissance" (Ray et al. 2018).
🆘 Static plot
🆘 No background maps
✅ Object identity
🆘 Direction
🆘 Speed
🆘 Time
Brunsdon, C., & Comber, A. (2020). Big issues for big data: challenges for critical spatial data analytics. Journal of Spatial Information Science, 2020(21), 89-98.
doi:10.5311/JOSIS.2020.21.625
Andrienko, G., & Andrienko, N. (2008). Exploration of massive movement data: a visual analytics approach. AGILE’08.
MovingPandas provides static plots using Matplotlib and interactive maps using HoloViews GeoViews (based on Bokeh). The default plot for a set of trajectories (TrajectoryCollection) draws each trajectory in a different color. As shown in Figure 2, background map tiles, as well as markers for trajectory start and end locations, can be readily added and customized. Alternatively, other DataFrame column names (or the keyword ‘speed’) can be specified to color the trajectory segments accordingly, as shown in Figure 3.
Scikit-mobility provides interactive plots using Folium. The default plot for a TrajDataFrame draws each trajectory in a different color and automatically puts green and red markers at the start and end locations, respectively, as shown in Figure 4. To enhance rendering performance, the plot function by default does not plot all trajectories and generalizes the rendered trajectories. These preprocessing steps are communicated to the user in the form of UserWarnings “Only the trajectories of the first 10 users will be plotted. Use the argument `max_users` to specify the desired number of users, or filter the TrajDataFrame.” and “If necessary, trajectories will be down-sampled to have at most `max_points` points. To avoid this, specify `max_points=None`.”
Trackintel provides static plots using Matplotlib. The default plot for trip legs created from position fixes draws each trip leg in a color indicating the moving object id (user). As Figure 5 show, in contrast to the previous libraries, the default plot function does not provide background maps. Instead, the function provides a plot_osm keyword that “will download an OSM street network and plot below the triplegs” (Trackintel documentation, 2022). This is certainly useful in the context of human movement in local urban environments but not suitable for the ship movement dataset used in this example.
Given the fast advances of data science tools and workflows, what is GIScience doing to ensure that its knowhow contributes to spatial data science practices? And what should we do (more)?