PyMove
PyMove is a Python library for processing and visualization of trajectories and other spatial-temporal data.
Main Features
PyMove proposes:
- A familiar and similar syntax to Pandas;
- Clear documentation;
- Extensibility, since you can implement your main data structure by manipulating other data structures such as Dask DataFrame, numpy arrays, etc., in addition to adding new modules;
- Flexibility, as the user can switch between different data structures;
- Operations for data preprocessing, pattern mining and data visualization.
Creating a Virtual Environment
It is recommended to create a virtual environment to use pymove.
Requirements: Anaconda Python distribution installed and accessible
- In the terminal client enter the following where
env_name
is the name you want to call your environment, and replacex.x
with the Python version you wish to use. (To see a list of available python versions first, type conda search "^python$" and press enter.)conda create -n <env_name> python=x.x
Press y to proceed. This will install the Python version and all the
associated anaconda packaged libraries atpath_to_your_anaconda_location/anaconda/envs/env_name
- Activate your virtual environment. To activate or switch into your virtual environment, simply type the following where yourenvname is the name you gave to your environment at creation.
conda activate <env_name>
- Now install the package from either
conda
,pip
orgithub
Conda instalation
conda install -c conda-forge pymove
Pip installation
pip install pymove
Github installation
- Clone this repository
git clone
https://github.com/InsightLab/PyMove
- Switch to folder PyMove
cd PyMove
- Switch to a new branch
git checkout -b developer
- Make a pull of branch
git pull origin developer
- Install pymove in developer mode
make dev
For windows users
If you installed from pip
or github
, you may encounter an error related to shapely
due to some dll dependencies. To fix this, run conda install shapely
.
Examples
You can see examples of how to use PyMove here
Mapping PyMove methods with the Paradigms of Trajectory Data Mining
- 1: Spatial Trajectories →
pymove.core
MoveDataFrame
DiscreteMoveDataFrame
- 2: Stay Point Detection →
pymove.preprocessing.stay_point_detection
create_or_update_move_stop_by_dist_time
create_or_update_move_and_stop_by_radius
- 3: Map-Matching →
pymove-osmnx
- 4: Noise Filtering →
pymove.preprocessing.filters
by_bbox
by_datetime
by_label
by_id
by_tid
clean_consecutive_duplicates
clean_gps_jumps_by_distance
clean_gps_nearby_points_by_distances
clean_gps_nearby_points_by_speed
clean_gps_speed_max_radius
clean_trajectories_with_few_points
clean_trajectories_short_and_few_points
clean_id_by_time_max
- 5: Compression →
pymove.preprocessing.compression
compress_segment_stop_to_point
- 6: Segmentation →
pymove.preprocessing.segmentation
bbox_split
by_dist_time_speed
by_max_dist
by_max_time
by_max_speed
- 7: Distance Measures →
pymove.distances
medp
medt
euclidean_distance_in_meters
haversine
- 8: Query Historical Trajectories →
pymove.query.query
range_query
knn_query
- 9: Managing Recent Trajectories
- 10: Privacy Preserving
- 11: Reducing Uncertainty
- 12: Moving Together Patterns
- 13: Clustering →
pymove.models.pattern_mining.clustering
elbow_method
gap_statistics
dbscan_clustering
- 14: Freq. Seq. Patterns
- 15: Periodic Patterns
- 16: Trajectory Classification
- 17: Trajectory Outlier / Anomaly Detection →
pymove.semantic.semantic
outliers
create_or_update_out_of_the_bbox
create_or_update_gps_deactivated_signal
create_or_update_gps_jump
create_or_update_short_trajectory
create_or_update_gps_block_signal
filter_block_signal_by_repeated_amount_of_points
filter_block_signal_by_time
filter_longer_time_to_stop_segment_by_id