Skip to content

firefly-cpp/TCX2Graph.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

118 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCX2Graph.jl -- Building Property Graphs from TCX Files

Version GitHub License GitHub Commit Activity

✨ Detailed insights📦 Installation🚀 Usage🗃️ Datasets🔗 Related packages/frameworks🔑 License

TCX2Graph.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

pkg> add TCX2Graph

🚀 Usage

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))
end

main()

🛤️ Segment Characteristics Example

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, DATASET2, DATASET3.

🔗 Related packages/frameworks

[1] tcxreader: Python reader/parser for Garmin's TCX file format.

[2] sport-activities-features: A minimalistic toolbox for extracting features from sports activity files written in Python

[3] tcxread: A parser for TCX files written in Ruby

[4] TCXReader.jl: Julia package designed for parsing TCX files

[5] AST-Monitor: A wearable Raspberry Pi computer for cyclists

🔑 License

This package is distributed under the MIT License. You can find the license at http://www.opensource.org/licenses/MIT.

Disclaimer

This package is provided as-is with no guarantees of fitness for any particular purpose. Use it at your own risk!

About

Building Property Graphs from TCX Files

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors