2

When I try to produce a self-contained html mapshot from the mapview package, it saves a separate folder with files, nevertheless. Also, it produces an error 99 which I could not get solved (but it still produces a working html).

Here a reproducible example:

library(mapview)
m = mapview(breweries)
m
## create standalone .html
mapshot(m, url = paste0(getwd(), "/map.html"), selfcontained = TRUE)

This gives me a nice html, but it is not self-contained. I get an html file and a folder called "map_files" that carries subfolders with js-files. Also it gives out the following error:

File map_files/PopupTable-0.0.1/popup.css not found in resource path
Error: pandoc document conversion failed with error 99

My session info:

R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 
 
locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] mapview_2.9.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5              RColorBrewer_1.1-2      compiler_4.0.3         
 [4] pillar_1.4.6            base64enc_0.1-3         class_7.3-17           
 [7] tools_4.0.3             uuid_0.1-4              digest_0.6.27          
[10] jsonlite_1.7.1          lubridate_1.7.9         satellite_1.0.2        
[13] lifecycle_0.2.0         tibble_3.0.4            lattice_0.20-41        
[16] pkgconfig_2.0.3         png_0.1-7               rlang_0.4.8            
[19] DBI_1.1.0               rstudioapi_0.11         crosstalk_1.1.0.1      
[22] yaml_2.2.1              e1071_1.7-4             dplyr_1.0.2            
[25] raster_3.3-13           leaflet.providers_1.9.0 systemfonts_0.3.2      
[28] gdtools_0.2.2           generics_0.1.0          htmlwidgets_1.5.2      
[31] vctrs_0.3.4             webshot_0.5.2           tidyselect_1.1.0       
[34] stats4_4.0.3            classInt_0.4-3          leaflet_2.0.3          
[37] grid_4.0.3              svglite_1.2.3.2         glue_1.4.2             
[40] sf_0.9-6                R6_2.5.0                leafpop_0.0.6          
[43] sp_1.4-4                purrr_0.3.4             magrittr_1.5           
[46] scales_1.1.1            codetools_0.2-16        htmltools_0.5.0        
[49] ellipsis_0.3.1          units_0.6-6             colorspace_1.4-1       
[52] brew_1.0-6              KernSmooth_2.23-17      munsell_0.5.0          
[55] leafem_0.1.3            crayon_1.3.4    
TylerH
  • 20,799
  • 66
  • 75
  • 101
Samuel
  • 431
  • 3
  • 10
  • 1
    The error should go away if you upodate from github `remotes::install_github("r-spatial/mapview")` – TimSalabim Nov 27 '20 at 07:44
  • Thank you! It worked for the reproducible example! It doesn't work for my actual code (yet), though. The error is gone, but for my actual code it still is not a self-contained html. – Samuel Nov 28 '20 at 10:47
  • Okay, I found something interesting: If you change the `url` to something other than the working directory, it does not give it as a self-contained file. e.g. `mapshot(m, url = paste0(getwd(), "/projects/map.html"), selfcontained = TRUE)` does not produce a self-contained file in the projects-folder but gives an html plus a folder with scripts. Do you have any idea why @TimSalabim ? – Samuel Nov 28 '20 at 11:15
  • What gdal version do you have? Does it work if you set `mapviewOptions(fgb = FALSE)`? – TimSalabim Nov 28 '20 at 15:19
  • I have rgdal 1.5-18 It is funny, I found out that it works if you put the path right in the working directory, but not if it is in a subfolder. – Samuel Dec 07 '20 at 21:59
  • When I execute `mapviewOptions(fgb = FALSE)`, a warning comes: option 'fgb' requires GDAL >= 3.1.0! Your version is 3.0.4. Setting fgb = FALSE It still doesn't work to produce a self-contained html outside in a subfolder. – Samuel Dec 07 '20 at 22:09
  • 1
    Then I am out of ideas, might be something to do with `saveWidget`... – TimSalabim Dec 08 '20 at 07:34
  • Thank you, nevertheless, for now, the workaround is to set and reset the working directory :) – Samuel Jan 10 '21 at 20:51

0 Answers0