Skip to content

Commit

Permalink
Merge pull request #50 from BalintKomjati/master
Browse files Browse the repository at this point in the history
Fixing Issue #49
  • Loading branch information
marcusvolz authored Mar 20, 2022
2 parents 0218edb + d69b1a5 commit 075da8e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
16 changes: 12 additions & 4 deletions R/plot_3D.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#' Create 3D interactive elevation map from gpx tracklogs
#'
#' @param tracklog_file A path to a gpx file to be read by strava::process_data.
#' If the file covers a big area plot_3D() can slow down significantly.
#' @param tracklog_folder The path to the folder of your gpx file to be read by strava::process_data().
#' process_data() will read all gpx files from this folder and plot_3D() will plot them all.
#' It is however recommended to PLACE ONLY ONE GPX file within the folder.
#' If the tracks cover an extended area plot_3D() can slow down significantly.
#' If tracklog_folder is undefined plot_3D() loads an example tracklog provided with the package.
#' @param cache_folder Directory to store the downloaded elevation data and overlay image for reuse
#' @param elevation_scale Horizontal vs vertical ratio of the plot. Could be estimated with geoviz::raster_zscale(dem).
#' @param elevation_scale_tracklog_corr Raises elevation_scale for the tracklog by the specified percentage.
Expand All @@ -25,7 +28,7 @@
#' strava::plot_3D()
#' }
plot_3D <- function(
tracklog_file = "gpx/mtb",
tracklog_folder = NULL,
cache_folder = "~/cache_plot_3D",
elevation_scale = 6, #
elevation_scale_tracklog_corr = .01,
Expand All @@ -44,7 +47,12 @@ plot_3D <- function(


message("Reading the tracklog")
tracklog <- strava::process_data(system.file(tracklog_file, package = "strava"))
if (is.null(tracklog_folder)) {
tracklog <- strava::process_data(system.file("gpx/mtb", package = "strava"))
} else {
tracklog <- strava::process_data(tracklog_folder)
}



if( paste0(dem_file,".gri") %>% file.exists() ) {
Expand Down
11 changes: 7 additions & 4 deletions man/plot_3D.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 075da8e

Please sign in to comment.