首页 > 解决方案 > R mapshot 无法创建自包含的 html

问题描述

当我尝试从 mapview 包中生成一个独立的 html 地图时,它会保存一个包含文件的单独文件夹。此外,它会产生一个我无法解决的错误 99(但它仍然会产生一个有效的 html)。

这是一个可重现的示例:

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

这给了我一个不错的 html,但它不是独立的。我得到一个 html 文件和一个名为“map_files”的文件夹,其中包含带有 js 文件的子文件夹。它还给出以下错误:

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

我的会话信息:

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    

标签: javascripthtmlrr-mapview

解决方案


推荐阅读