geocompx / geocompr

Geocomputation with R: an open source book
https://r.geocompx.org/
Other
1.59k stars 585 forks source link

Error in Section 8.9 #1087

Closed biscotty666 closed 7 months ago

biscotty666 commented 7 months ago

At the end of Chapter 8, the final code block. It first complained it couldn't find a chrome browser but I fixed that. Now I get this:

Code

library(mapview)
mapview_obj = mapview(world, zcol = "lifeExp", legend = TRUE)
mapshot2(mapview_obj, file = "my_interactive_map.html")

error

Error in new_session_screenshot(cm, args$url, args$file, args$vwidth,  : 
  File extension must be one of: png, jpg, jpeg, webp, pdf

traceback

9.
stop("File extension must be one of: ", paste(filetypes, collapse = ", "))
8.
new_session_screenshot(cm, args$url, args$file, args$vwidth,
args$vheight, args$selector, args$cliprect, args$expand,
args$delay, args$zoom, args$useragent, quiet)
7.
FUN(X[[i]], ...)
6.
lapply(args_all, function(args) {
new_session_screenshot(cm, args$url, args$file, args$vwidth,
args$vheight, args$selector, args$cliprect, args$expand,
args$delay, args$zoom, args$useragent, quiet) ...
5.
(function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744,
selector = NULL, cliprect = NULL, expand = NULL, delay = 0.2,
zoom = 1, useragent = NULL, max_concurrent = getOption("webshot.concurrent",
default = 6), quiet = getOption("webshot.quiet", default = FALSE)) ...
4.
do.call(webshot2::webshot, args[ws_args])
3.
withCallingHandlers(expr, message = function(c) if (inherits(c,
classes)) tryInvokeRestart("muffleMessage"))
2.
suppressMessages(do.call(webshot2::webshot, args[ws_args]))
1.
mapshot2(mapview_obj, file = "my_interactive_map.html")

Cheers

Nowosad commented 7 months ago

Dear @biscotty666 -- thanks for letting us know about the issue. I have fixed it. The problem was that a wrong argument was set.

Old code:

mapshot2(mapview_obj, file = "my_interactive_map.html")

New code:

mapshot2(mapview_obj, url = "my_interactive_map.html")