- Notifications
You must be signed in to change notification settings - Fork94
Description
Hello, I ran into a very specific and strange issue that I was hoping someone can give me insight on. For some reason,mapshot2 is unable to capture the entire Leaflet map whenever I'm using a map from providers that are not CartoDB.
mapshot2 perfectly saves the Leaflet map when I'm using the CartoDB map provider. However, if I'm using other providers like OpenStreetMap or Esri,mapshot2 cannot save the entire image. Pieces were left blank. I've provided an example with code and screenshots below.
library(leaflet)library(dplyr)library(mapview)plot1 <- leaflet() %>% # Add Leaflet-provided map from CartoDB leaflet::addProviderTiles("CartoDB.Positron") %>% leaflet::setView( lng = 100, lat = 0, zoom = 4 )plot1# plot1 is perfectly savedmapview::mapshot2(plot1, file = "plot1.png")plot2 <- leaflet() %>% # Add Leaflet-provided map from OpenStreetMap leaflet::addProviderTiles("OpenStreetMap.Mapnik")%>% leaflet::setView( lng = 100, lat = 0, zoom = 4 )plot2# plot2 has missing pieces around the edgesmapview::mapshot2(plot2, file = "plot2.png")And here is what plot1 looks like, with no missing pieces:
And here is what plot2 looks like, with entire edges/borders missing:
I'm usingmapview 2.11.2 andleaflet 2.2.2. Not quite sure exactly where this strange error comes from...
I've also attached my session info below. Any help is much appreciated, thank you!
R version 4.4.2 (2024-10-31)Platform: aarch64-apple-darwin20Running under: macOS Sonoma 14.6Matrix products: defaultBLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0locale:[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8time zone: America/New_Yorktzcode source: internalattached base packages:[1] stats graphics grDevices utils datasets methods base other attached packages:[1] mapview_2.11.2 dplyr_1.1.4 leaflet_2.2.2 loaded via a namespace (and not attached): [1] generics_0.1.3 class_7.3-23 KernSmooth_2.23-26 lattice_0.22-6 [5] digest_0.6.37 magrittr_2.0.3 evaluate_1.0.3 grid_4.4.2 [9] fastmap_1.2.0 jsonlite_1.9.1 processx_3.8.6 e1071_1.7-16 [13] chromote_0.4.0.9000 DBI_1.2.3 ps_1.9.0 promises_1.3.2 [17] crosstalk_1.2.1 scales_1.3.0 codetools_0.2-20 jquerylib_0.1.4 [21] cli_3.6.3 rlang_1.1.5 units_0.8-5 munsell_0.5.1 [25] yaml_2.3.10 base64enc_0.1-3 tools_4.4.2 raster_3.6-31 [29] colorspace_2.1-1 vctrs_0.6.5 R6_2.6.1 png_0.1-8 [33] stats4_4.4.2 proxy_0.4-27 lifecycle_1.0.4 classInt_0.4-11 [37] leaflet.providers_2.0.0 htmlwidgets_1.6.4 pkgconfig_2.0.3 later_1.4.1 [41] terra_1.8-21 pillar_1.10.1 glue_1.8.0 Rcpp_1.0.14 [45] sf_1.0-19 xfun_0.50 tibble_3.2.1 tidyselect_1.2.1 [49] knitr_1.49 rstudioapi_0.17.1 websocket_1.4.2 htmltools_0.5.8.1 [53] rmarkdown_2.29 leafem_0.2.3 webshot2_0.1.1 satellite_1.0.5 [57] compiler_4.4.2 sp_2.2-0
