firefly-cpp / TCX2Graph.jl

Building Property Graphs from TCX Files
MIT License
1 stars 0 forks source link

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

πŸ“¦ 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!