https://github.com/firefly-cpp/tcx2graph.jl
Building Property Graphs from TCX Files
https://github.com/firefly-cpp/tcx2graph.jl
Last synced: 4 months ago
JSON representation
Building Property Graphs from TCX Files
- Host: GitHub
- URL: https://github.com/firefly-cpp/tcx2graph.jl
- Owner: firefly-cpp
- License: mit
- Created: 2024-04-10T13:07:37.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-30T13:02:18.000Z (5 months ago)
- Last Synced: 2025-01-30T13:35:39.515Z (5 months ago)
- Language: Julia
- Homepage:
- Size: 3 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
TCX2Graph.jl -- Building Property Graphs from TCX Files
✨ Detailed insights •
📦 Installation •
🚀 Usage •
🗃️ Datasets •
🔗 Related packages/frameworks •
🔑 LicenseTCX2Graph.jl is a Julia package designed to facilitate the transformation of TCX data into property graphs, enabling the analysis of overlapping paths and shared segments in cycling routes. This package simplifies the process of converting `.tcx` files, commonly generated by GPS-enabled fitness devices, into graph representations that can be used for various analyses, such as detecting shared segments, mapping frequently traveled routes, and segment-based metrics.
TCX2Graph.jl employs a **KDTree** for efficient spatial queries, allowing rapid identification of overlapping segments across multiple cycling paths.
## ✨ Detailed insights
- **TCX2Graph.jl** processes TCX data by creating property graphs where vertices represent GPS points, and edges represent consecutive points in paths.
- Detects overlapping segments across multiple paths using a **KDTree** for efficient spatial queries and generates metrics like distance, ascent, descent, and gradients.
- Visualizes overlapping segments and paths, enabling better insights into route usage and shared path segments.
- Supports the extraction of transactions for path segments, useful for pattern detection and frequent segment analysis.## 📦 Installation
```julia
pkg> add TCX2Graph
```## 🚀 Usage
```julia
using TCX2Graph# Example to process TCX files and generate a property graph
function main()
# Path to the folder containing the .tcx files
tcx_folder_path = TCX2Graph.get_absolute_path("../example_data/files")# Process TCX files to generate graphs and analyze paths
graph, gps_data, paths = TCX2Graph.create_property_graph(tcx_folder_path)
kdtree = TCX2Graph.create_kdtree_index(gps_data)# Find overlapping segments and compute characteristics
overlapping_segments = TCX2Graph.find_overlapping_segments_across_paths(gps_data, paths, kdtree)
TCX2Graph.plot_individual_overlapping_segments(gps_data, paths, overlapping_segments, "./output/")
println("Overlapping segments: ", length(overlapping_segments))
endmain()
```### 🛤️ Segment Characteristics Example
```julia
using TCX2Graph# After detecting overlapping segments
segment_idx = 1
total_distance, total_ascent, total_descent, total_vertical_meters, max_gradient, avg_gradient =
TCX2Graph.compute_segment_characteristics(segment_idx, gps_data, overlapping_segments)println("Segment Characteristics:")
println("Distance: $total_distance meters")
println("Ascent: $total_ascent meters")
println("Descent: $total_descent meters")
println("Max Gradient: $(max_gradient * 100)%")
println("Average Gradient: $(avg_gradient * 100)%")
```## 🗃️ Datasets
Datasets available and used in the examples on the following links: [DATASET1](http://iztok-jr-fister.eu/static/publications/Sport5.zip), [DATASET2](http://iztok-jr-fister.eu/static/css/datasets/Sport.zip), [DATASET3](https://github.com/firefly-cpp/tcx-test-files).
## 🔗 Related packages/frameworks
[1] [tcxreader: Python reader/parser for Garmin's TCX file format.](https://github.com/alenrajsp/tcxreader)
[2] [sport-activities-features: A minimalistic toolbox for extracting features from sports activity files written in Python](https://github.com/firefly-cpp/sport-activities-features)
[3] [tcxread: A parser for TCX files written in Ruby](https://github.com/firefly-cpp/tcxread)
[4] [TCXReader.jl: Julia package designed for parsing TCX files](https://github.com/firefly-cpp/TCXReader.jl)
[5] [AST-Monitor: A wearable Raspberry Pi computer for cyclists](https://github.com/firefly-cpp/AST-Monitor)
## 🔑 License
This package is distributed under the MIT License. You can find the license at .
## Disclaimer
This package is provided as-is with no guarantees of fitness for any particular purpose. Use it at your own risk!