r-spatial / mapview

Interactive viewing of spatial data in R
https://r-spatial.github.io/mapview/
GNU General Public License v3.0
518 stars 91 forks source link

Blank image from mapshot #380

Open PaulC91 opened 3 years ago

PaulC91 commented 3 years ago

Hi Tim. I'm trying to save a png export with mapshot but the saved image is always blank. Reprex and saved image below. Thanks!

sf::sf_extSoftVersion()
#>           GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H 
#>        "3.8.1"        "3.1.4"        "6.3.1"         "true"         "true"
library(mapview)
mapviewOptions(fgb = FALSE) # getting mime type error with fgb = TRUE
m <- mapview(breweries)
mapshot(m, file = "~/Downloads/mapshot_test.png")

Created on 2021-05-10 by the reprex package (v1.0.0)

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.0.3 (2020-10-10) #> os macOS Mojave 10.14.6 #> system x86_64, darwin17.0 #> ui X11 #> language (EN) #> collate en_GB.UTF-8 #> ctype en_GB.UTF-8 #> tz Europe/Paris #> date 2021-05-10 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date lib #> assertthat 0.2.1 2019-03-21 [1] #> backports 1.2.0 2020-11-02 [1] #> base64enc 0.1-3 2015-07-28 [1] #> brew 1.0-6 2011-04-13 [1] #> callr 3.5.1 2020-10-13 [1] #> class 7.3-17 2020-04-26 [1] #> classInt 0.4-3 2020-04-07 [1] #> cli 2.4.0 2021-04-05 [1] #> codetools 0.2-16 2018-12-24 [1] #> colorspace 2.0-0 2020-11-11 [1] #> crayon 1.3.4 2017-09-16 [1] #> crosstalk 1.1.0.1 2020-03-13 [1] #> DBI 1.1.0 2019-12-15 [1] #> digest 0.6.27 2020-10-24 [1] #> dplyr 1.0.6 2021-05-05 [1] #> e1071 1.7-4 2020-10-14 [1] #> ellipsis 0.3.1 2020-05-15 [1] #> evaluate 0.14 2019-05-28 [1] #> fansi 0.4.1 2020-01-08 [1] #> fs 1.5.0 2020-07-31 [1] #> gdtools 0.2.2 2020-04-03 [1] #> generics 0.1.0 2020-10-31 [1] #> glue 1.4.2 2020-08-27 [1] #> highr 0.8 2019-03-20 [1] #> htmltools 0.5.1.1 2021-01-22 [1] #> htmlwidgets 1.5.3 2020-12-10 [1] #> jsonlite 1.7.1 2020-09-07 [1] #> KernSmooth 2.23-17 2020-04-26 [1] #> knitr 1.30 2020-09-22 [1] #> lattice 0.20-41 2020-04-02 [1] #> leafem 0.1.3 2020-07-26 [1] #> leaflet 2.0.3.9000 2020-12-08 [1] #> leaflet.providers 1.9.0 2019-11-09 [1] #> leafpop 0.0.6 2020-09-22 [1] #> lifecycle 1.0.0 2021-02-15 [1] #> magrittr 2.0.1 2020-11-17 [1] #> mapview * 2.9.9 2021-05-10 [1] #> munsell 0.5.0 2018-06-12 [1] #> pillar 1.6.0 2021-04-13 [1] #> pkgconfig 2.0.3 2019-09-22 [1] #> png 0.1-7 2013-12-03 [1] #> processx 3.4.5 2020-11-30 [1] #> ps 1.5.0 2020-12-05 [1] #> purrr 0.3.4 2020-04-17 [1] #> R6 2.5.0 2020-10-28 [1] #> raster 3.4-5 2020-11-14 [1] #> RColorBrewer 1.1-2 2014-12-07 [1] #> Rcpp 1.0.5 2020-07-06 [1] #> reprex 1.0.0 2021-01-27 [1] #> rlang 0.4.10 2020-12-30 [1] #> rmarkdown 2.5 2020-10-21 [1] #> rstudioapi 0.13 2020-11-12 [1] #> satellite 1.0.2 2019-12-09 [1] #> scales 1.1.1 2020-05-11 [1] #> sessioninfo 1.1.1 2018-11-05 [1] #> sf 0.9-8 2021-03-17 [1] #> sp 1.4-4 2020-10-07 [1] #> stringi 1.5.3 2020-09-09 [1] #> stringr 1.4.0 2019-02-10 [1] #> styler 1.3.2 2020-02-23 [1] #> svglite 1.2.3.2 2020-07-07 [1] #> systemfonts 1.0.1 2021-02-09 [1] #> tibble 3.1.1 2021-04-18 [1] #> tidyselect 1.1.0 2020-05-11 [1] #> units 0.6-7 2020-06-13 [1] #> utf8 1.1.4 2018-05-24 [1] #> uuid 0.1-4 2020-02-26 [1] #> vctrs 0.3.7 2021-03-29 [1] #> webshot 0.5.2 2019-11-22 [1] #> withr 2.3.0 2020-09-22 [1] #> xfun 0.19 2020-10-30 [1] #> yaml 2.2.1 2020-02-01 [1] #> source #> standard (@0.2.1) #> standard (@1.2.0) #> standard (@0.1-3) #> standard (@1.0-6) #> standard (@3.5.1) #> CRAN (R 4.0.3) #> standard (@0.4-3) #> standard (@2.4.0) #> CRAN (R 4.0.3) #> standard (@2.0-0) #> standard (@1.3.4) #> standard (@1.1.0.1) #> standard (@1.1.0) #> standard (@0.6.27) #> standard (@1.0.6) #> standard (@1.7-4) #> standard (@0.3.1) #> standard (@0.14) #> standard (@0.4.1) #> standard (@1.5.0) #> standard (@0.2.2) #> standard (@0.1.0) #> standard (@1.4.2) #> standard (@0.8) #> standard (@0.5.1.1) #> standard (@1.5.3) #> standard (@1.7.1) #> CRAN (R 4.0.3) #> standard (@1.30) #> CRAN (R 4.0.3) #> standard (@0.1.3) #> Github (paulc91/leaflet@654d728) #> standard (@1.9.0) #> standard (@0.0.6) #> standard (@1.0.0) #> standard (@2.0.1) #> Github (r-spatial/mapview@e9f7954) #> standard (@0.5.0) #> standard (@1.6.0) #> standard (@2.0.3) #> standard (@0.1-7) #> standard (@3.4.5) #> standard (@1.5.0) #> standard (@0.3.4) #> standard (@2.5.0) #> standard (@3.4-5) #> standard (@1.1-2) #> standard (@1.0.5) #> standard (@1.0.0) #> standard (@0.4.10) #> standard (@2.5) #> standard (@0.13) #> standard (@1.0.2) #> standard (@1.1.1) #> standard (@1.1.1) #> standard (@0.9-8) #> standard (@1.4-4) #> standard (@1.5.3) #> standard (@1.4.0) #> standard (@1.3.2) #> standard (@1.2.3.2) #> standard (@1.0.1) #> standard (@3.1.1) #> standard (@1.1.0) #> standard (@0.6-7) #> standard (@1.1.4) #> standard (@0.1-4) #> standard (@0.3.7) #> standard (@0.5.2) #> standard (@2.3.0) #> standard (@0.19) #> standard (@2.2.1) #> #> [1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library ```

mapshot_test

tim-salabim commented 3 years ago

Works for me with the reprex above.

mapshot_test

Session info ``` r sessioninfo::session_info() ─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────── setting value version R version 4.0.5 (2021-03-31) os Ubuntu 20.04.2 LTS system x86_64, linux-gnu ui RStudio language (EN) collate en_US.UTF-8 ctype en_US.UTF-8 tz Europe/Berlin date 2021-05-10 ─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────── package * version date lib source anytime 0.3.9 2020-08-27 [1] CRAN (R 4.0.5) base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.0.4) bitops 1.0-6 2013-08-17 [1] CRAN (R 4.0.4) brew 1.0-6 2011-04-13 [1] CRAN (R 4.0.4) callr 3.6.0 2021-03-28 [1] CRAN (R 4.0.5) changepoint 2.2.2 2016-10-04 [1] CRAN (R 4.0.4) class 7.3-19 2021-05-03 [4] CRAN (R 4.0.5) classInt 0.4-3 2020-04-07 [1] CRAN (R 4.0.4) cli 2.5.0 2021-04-26 [1] CRAN (R 4.0.5) codetools 0.2-18 2020-11-04 [4] CRAN (R 4.0.3) colorspace 2.0-1 2021-05-04 [1] CRAN (R 4.0.5) condimon 0.0.9 2021-03-10 [1] local crayon 1.4.1 2021-02-08 [1] CRAN (R 4.0.4) crosstalk 1.1.1 2021-01-12 [1] CRAN (R 4.0.4) curl 4.3 2019-12-02 [1] CRAN (R 4.0.4) data.table * 1.14.0 2021-02-21 [1] CRAN (R 4.0.4) DBI 1.1.1 2021-01-15 [1] CRAN (R 4.0.4) digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.4) dplyr 1.0.5 2021-03-05 [1] CRAN (R 4.0.4) DStoolboxLite * 0.1.3 2021-05-05 [1] local e1071 1.7-6 2021-03-18 [1] CRAN (R 4.0.5) ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.0.5) evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.4) fansi 0.4.2 2021-01-15 [1] CRAN (R 4.0.4) fasttime 1.0-2 2016-10-26 [1] CRAN (R 4.0.4) forecast 8.14 2021-03-11 [1] CRAN (R 4.0.5) fracdiff 1.5-1 2020-01-24 [1] CRAN (R 4.0.5) generics 0.1.0 2020-10-31 [1] CRAN (R 4.0.4) ggplot2 * 3.3.3 2020-12-30 [1] CRAN (R 4.0.4) glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.4) gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.4) h2o 3.32.0.4 2021-03-11 [1] local htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.0.4) htmlwidgets 1.5.3 2020-12-10 [1] CRAN (R 4.0.4) httr 1.4.2 2020-07-20 [1] CRAN (R 4.0.4) inspectr * 0.1.1 2021-04-28 [1] local jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.0.4) KernSmooth 2.23-18 2020-10-29 [4] CRAN (R 4.0.3) knitr 1.31 2021-01-27 [1] CRAN (R 4.0.4) lattice 0.20-44 2021-05-02 [4] CRAN (R 4.0.5) lazyeval 0.2.2 2019-03-15 [1] CRAN (R 4.0.4) leafem 0.1.5 2021-05-04 [1] Github (r-spatial/leafem@9cf9518) leaflet 2.0.4.1 2021-01-07 [1] CRAN (R 4.0.4) leaflet.providers 1.9.0 2019-11-09 [1] CRAN (R 4.0.4) leafpop 0.0.8 2021-05-07 [1] local lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.0.4) lmtest 0.9-38 2020-09-09 [1] CRAN (R 4.0.4) lubridate 1.7.10 2021-02-26 [1] CRAN (R 4.0.4) lutz 0.3.1 2019-07-19 [1] CRAN (R 4.0.4) magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.4) mapview * 2.9.9 2021-05-03 [1] local munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.4) nlme 3.1-152 2021-02-04 [4] CRAN (R 4.0.3) nnet 7.3-15 2021-01-24 [4] CRAN (R 4.0.3) pillar 1.6.0 2021-04-13 [1] CRAN (R 4.0.5) pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.4) plotly * 4.9.3 2021-01-10 [1] CRAN (R 4.0.4) png 0.1-7 2013-12-03 [1] CRAN (R 4.0.4) processx 3.5.1 2021-04-04 [1] CRAN (R 4.0.5) proxy 0.4-25 2021-03-05 [1] CRAN (R 4.0.4) ps 1.6.0 2021-02-28 [1] CRAN (R 4.0.4) purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.4) quadprog 1.5-8 2019-11-20 [1] CRAN (R 4.0.5) quantmod 0.4.18 2020-12-09 [1] CRAN (R 4.0.5) R6 * 2.5.0 2020-10-28 [1] CRAN (R 4.0.4) raster 3.4-10 2021-05-03 [1] CRAN (R 4.0.5) RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 4.0.4) Rcpp 1.0.6 2021-01-15 [1] CRAN (R 4.0.4) RCurl 1.98-1.2 2020-04-18 [1] CRAN (R 4.0.4) rlang 0.4.11 2021-04-30 [1] CRAN (R 4.0.5) rmarkdown 2.7 2021-02-19 [1] CRAN (R 4.0.4) satellite 1.0.2 2019-12-09 [1] CRAN (R 4.0.4) scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.4) sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.4) sf 0.9-8 2021-03-17 [1] CRAN (R 4.0.5) sp 1.4-5 2021-01-10 [1] CRAN (R 4.0.4) suncalc 0.5.0 2019-04-03 [1] CRAN (R 4.0.4) svglite 2.0.0 2021-02-20 [1] CRAN (R 4.0.4) systemfonts 1.0.1 2021-02-09 [1] CRAN (R 4.0.4) tibble 3.1.1 2021-04-18 [1] CRAN (R 4.0.5) tidyr 1.1.3 2021-03-03 [1] CRAN (R 4.0.4) tidyselect 1.1.0 2020-05-11 [1] CRAN (R 4.0.4) timeDate 3043.102 2018-02-21 [1] CRAN (R 4.0.5) tseries 0.10-48 2020-12-04 [1] CRAN (R 4.0.5) TTR 0.24.2 2020-09-01 [1] CRAN (R 4.0.5) units 0.7-1 2021-03-16 [1] CRAN (R 4.0.5) urca 1.3-0 2016-09-06 [1] CRAN (R 4.0.5) utf8 1.2.1 2021-03-12 [1] CRAN (R 4.0.4) uuid 0.1-4 2020-02-26 [1] CRAN (R 4.0.4) vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.0.5) viridisLite 0.4.0 2021-04-13 [1] CRAN (R 4.0.5) webshot 0.5.2 2019-11-22 [1] CRAN (R 4.0.4) withr 2.4.2 2021-04-18 [1] CRAN (R 4.0.5) xfun 0.22 2021-03-11 [1] CRAN (R 4.0.5) xts 0.12.1 2020-09-09 [1] CRAN (R 4.0.5) yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.4) zoo * 1.8-9 2021-03-09 [1] CRAN (R 4.0.4) [1] /home/tim/R/x86_64-pc-linux-gnu-library/4.0 [2] /usr/local/lib/R/site-library [3] /usr/lib/R/site-library [4] /usr/lib/R/library ```
ffholmes commented 4 months ago

@PaulC91 did you resolve this? I am having the same problem!!

PaulC91 commented 3 months ago

@ffholmes I switched to mapshot2() which did the job for me.