Skip to contents

Creates visualisations of a GPS route, including an elevation profile and a route map.

Usage

plot_route(track_points)

Arguments

track_points

A data frame containing track points with the following required columns:

  • lon - longitude in decimal degrees

  • lat - latitude in decimal degrees

  • ele - elevation in metres

  • cumulative_distance - distance in kilometres

Value

Plots are displayed in the current graphics device. The function does not return a value.

Details

This function creates two visualisations:

  • An elevation profile showing elevation changes against distance travelled

  • A simple route map showing the geographical path

Both plots are created using ggplot2 with minimal styling.

Examples

# Use the example GPX file included in the package
example_gpx_path <- system.file("extdata", "icc_intro_ride.gpx", package = "gpxtoolbox")

# First read a GPX file
track_data <- read_gpx_track(example_gpx_path)

# Calculate cumulative distance (required for plotting)
track_data <- calculate_distance(track_data)

# Plot the route visualisations
plot_route(track_data)