Skip to content

Commit

Permalink
tmap_save returns filename invisibly
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Feb 9, 2024
1 parent 05a9db2 commit 8c8e0c3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
9 changes: 5 additions & 4 deletions R/tmap_save.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@
#' usually take more space then the map resources.
#' @param verbose Deprecated. It is now controlled by the tmap option `show.messages`
#' (see [tmap_options()])
#' @param ... arguments passed on to device functions or to
#' [`saveWidget()`][htmlwidgets::saveWidget()] or [`saveWidgetFrame()`][widgetframe::saveWidgetframe()]
#' @inheritDotParams htmlwidgets::saveWidget
#' @inheritDotParams widgetframe::saveWidgetframe
#' @returns the filename, invisibly, if export is successful.
#' @importFrom htmlwidgets saveWidget
#' @import tmaptools
#' @example ./examples/tmap_save.R
Expand Down Expand Up @@ -151,7 +152,7 @@ tmap_save = function(tm=NULL, filename=NA, device=NULL, width=NA, height=NA, uni
if (verbose) {
message("Interactive map saved to ", suppressWarnings(normalizePath(filename)))
}
return(invisible())
return(invisible(filename))
}

if (is.na(width) || is.na(height)) {
Expand Down Expand Up @@ -265,7 +266,7 @@ tmap_save = function(tm=NULL, filename=NA, device=NULL, width=NA, height=NA, uni
}
}
options(tmap.mode=tmap.mode)
invisible()
invisible(filename)
}

plot_device = function(device, ext, filename, dpi, units_target){
Expand Down
17 changes: 15 additions & 2 deletions man/tmap_save.Rd

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

0 comments on commit 8c8e0c3

Please sign in to comment.