mapshot broken without and with fgb
library(sf)
bp_file <- system.file("gpkg/b_pump.gpkg", package="sf")
b_pump_sf <- st_read(bp_file, quiet=TRUE)
library(mapview)
# GDAL version >= 3.1.0 | setting mapviewOptions(fgb = TRUE)
mapviewOptions(fgb = FALSE)
webmap1 <- mapview(b_pump_sf, map.type="OpenStreetMap")
webmap1
mapshot(webmap1, file="webmap1.png")
# File filef86516aae932_files/PopupTable-0.0.1/popup.css not found in resource path
# Error: pandoc document conversion failed with error 99
mapviewOptions(fgb = TRUE)
webmap1 <- mapview(b_pump_sf, map.type="OpenStreetMap"
mapshot(webmap1, file="webmap1.png")
# Could not determine mime type for `filef865709ec120_files/b_pump_sf-0.0.1/b_pump_sf_layer.fgb'
# Error: pandoc document conversion failed with error 63
mapview_2.9.0 sf_0.9-5
Yeah, sorry, it should work again with mapviewOptions(fgb = FALSE) if you re-install from guthub (Note that the develop branch is obsolete now!). I messed up the css file lookup in the last CRAN release.
remotes::install_github("r-spatial/mapview")
As for mapviewOptions(fgb = TRUE) that is out of our hands. As long as pandoc doesn't know about the mime type for .fgb this will not work... I don't know how to get the file format recognised/included in pandoc
Thanks for a fast response! As pandoc is written in haskell, it looks hard to work out what to do as a PR, so maybe until then you'd need to convert internally to a format pandoc recognises. I guess the RStudio people could advise about how to get a MIME definition and the required haskell conversion functions submitted. Did you ask them?
Not yet, I was thinking to ask @bjornharrtell first. I guess that the R community is not the only community to run into this issue...
I would say application/flatgeobuf should be safe to use.
It's a long road to get an official mimetype and requires an organization to apply, so it's a bit out of my hands as I'm not very interested in getting into the politics of that.
Thanks @bjornharrtell for the input here. I have no experience with these kind of things, but from what you say it seems like we'd need to get ogc on board (as it's officially part of gdal). @rsbivand any thoughts?
Perhaps osgeo is easier to involve but ogc would be fun too (as long as it doesn't involve tons of administration). Any help with either would be very welcome. 🙂
I wouldn't bet on getting a proper mimetype any time soon. I find it strange that it would be a hard requirement for something as specific as geospatial software/formats. That would also mean you couldn't use that software with something internal/proprietary?
Thanks! I'll leave this open as a reminder to not forget...
Hello, Apologies - relatively new to R. I've worked through the steps above including fgb = FALSE and reinstalling from github, but I am still getting the same issue when trying to save an html file using mapshot.
The error message is:
`> mapshot(m51, url = "map1.html", file = ".html")
Could not determine mime type for map1_files/tvp_lsoa3-Vehicle_Rate-0.0.1/tvp_lsoa3-Vehicle_Rate_layer.fgb' Error: pandoc document conversion failed with error 63
Is this the known issue still or something else going on?
@owenmiller95 use mapviewOptions(fgb = FALSE) - mime-types are not under the control of R packages. The option chooses not to use the FlatGeoBuf driver https://gdal.org/drivers/vector/flatgeobuf.html new in GDAL >= 3.1; hopefully a mime entry will be created sometime. FlatGeoBuf is a much faster format when it becomes usable, but for now use the option to turn its use off. The issue is known, see the earlier entries.
I'm not sure what was fixed, but it's still a problem:
library(mapview)
GDAL version >= 3.1.0 | setting mapviewOptions(fgb = TRUE)
But whenever I want to print this with the mapviewOptions(fgb = FALSE)
mapviewOptions(fgb = FALSE)
mapshot(x = map.out1,
remove_url = TRUE,
vwidth = 840,
vheight = 500,
file = file.path(normalizePath(dirname(f)),basename(f)),
remove_controls = c("zoomControl", "layersControl", "homeButton"))
The error is still there...
Could not determine mime type for `file736f2dbc5366_files/layername-0.0.1/layername_layer.fgb'
Error: pandoc document conversion failed with error 63
Is there a fix or not? (I'm using mapview 2.9.0)
The option needs to be set before creating the map - map.out1 in your case - not before calling mapshot.
Excellent catch! Thank you very much for the very fast reply 🥇
I guess the .fgb and rmarkdown issue is still an open item. I built a dashboard about a year ago using mapview 2.7.8. It worked fine. I just updated the data an reran. Would not compile new dashboard. Spent two days screwing with mime, temp files and .fgb I files. Finally saw this post and reinstalled mapview 2.7.8. Worked fine.
I tried .fgb = false trick. It did not work with 2.9 mapview. I am running r ver 4.0 on win 10. Also, I did update most recent pandoc. Best solution may be to use old mapview version.
Heads up that this is likely fixed in upstream dependency pandoc with https://github.com/jgm/pandoc/issues/7202 but unfortunately it's not released yet.
Thanks for the update. Any timeframe for release?
@donojazz I have no idea, not involved/engaged in pandoc.
Thanks
@bjornharrtell thanks for linking the pandoc thread! @donojazz can you try the github version of mapview? This should be solved already...
I tried to install that version during my quest and has issues installing the .dll file in windows. Decided to stop, delete 2.9 and backpedal to 2.8.
...\R\win-library\4.0\xfun\libs\x64\xfun.dll: Permission denied
Got tired of messing with it and just reverted back to old version. Then it worked.
Ok, xfun.dll is not related to mapview but likely to one of its dependencies. I am hoping to release to cran soon.
Looking forward to it.
I finally figured out which level I needed to change for access to security permissions.
I installed using remotes::install_github("r-spatial/mapview") . Reran everything and it generated a flextable.
Here is attached packages:
other attached packages:
[1] knitr_1.33 maps_3.3.0 lubridate_1.7.10 sparklyr_1.6.2 fasttime_1.0-2 data.table_1.14.0
[7] RColorBrewer_1.1-2 plotly_4.9.3 ggmap_3.0.0 tidycensus_0.11.4 censusxy_1.0.1 mapview_2.9.9
[13] leafpop_0.0.6 leaflet_2.0.4.1 sf_0.9-8 rgdal_1.5-23 sp_1.4-5 forcats_0.5.1
[19] stringr_1.4.0 dplyr_1.0.6 purrr_0.3.4 readr_1.4.0 tidyr_1.1.3 tibble_3.1.1
[25] ggplot2_3.3.3 tidyverse_1.3.1
Looks like mapview 2.9.9 from github works. JD
R version 4.0.2 (2020-06-22) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042)
Pandoc v ‘2.13’
@bjornharrtell @tim-salabim @rsbivand @beausoleilmo @donojazz
Hi guys! Facing this issue all of a sudden. I have a couple of rmd files running one after the other and suddenly facing this issue in this fifth Rmd while knitting. Could you please help?
Falling back to 'combined_singleR.knit' Could not determine mime type for `/MG/SHARED/ANALYSIS/DEMUX/TEST_sc/2002332/sc_results/DMSO_LIB_GEX_hpca.annotation.rds' Error: pandoc document conversion failed with error 63
This is the required info.
version _ platform x86_64-pc-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 4 minor 0.5 year 2021 month 03 day 31 svn rev 80133 language R version.string R version 4.0.5 (2021-03-31) nickname Shake and Throw
rmarkdown::pandoc_version() [1] ‘2.7.2’ packageVersion("markdown") [1] ‘1.1’ packageVersion("rmarkdown") [1] ‘2.9’
Seems like you want to include (read/write) some R specific data set (.rds) for which there does not seem to be a mime type definition for pandoc. Not convinced this is related to .fgb files...
@tim-salabim Yes, its an rds but my previous rmarkdown commands are working and the last one when I am using, I am getting this mime issue. Any way to surpass this?
probably try another file format. Can you save the data as e.g. csv?