Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapview::mapshot() and htmlwidgets::saveWidget() not working to export as .html #4

Open
aito123 opened this issue Oct 13, 2021 · 4 comments

Comments

@aito123
Copy link

aito123 commented Oct 13, 2021

Hello i think this should be addressed:

i have two mapview or leaflet objects:

peru_sync<- sync(peru_mapa1, peru_mapa2)

and when i try to save them as a .html file this happens:

mapshot(peru_sync, url = "peru_mapa_sync.html")

Error in .getNamespace(pkg) : invalid type/length (symbol/0) in vector allocation

Help, thanks

@tim-salabim
Copy link
Member

Have you seen r-spatial/mapview#35?

@aito123
Copy link
Author

aito123 commented Oct 14, 2021

Thanks for the reply Tim. I did see that post though it didn't work for my case scenario. I was looking for a option inside mapview package but i don't think there is.

Luckily i work around my problem and solve it.
I haven't been able to export a sync html mapview in rscript but it is absolutely possible in Rmarkdown. But now my problem is that when i knit my .Rmd with my sync(map1, map2) argument i can't show it fullscreen. Like when you put in r chunk (l-screen) for a wide view. Any solution in that? Thanks for listening.

@aditya4196
Copy link

aditya4196 commented Apr 22, 2022

Hi,
In the below code,
final_map <- leafletProxy("second_stage_map", session) %>% clearControls() %>% clearGroup("selected_poly") %>% addProviderTiles(providers$Esri.NatGeoWorldMap)
and then to save the map as an image
mapshot(final_map, file=paste0(getwd(), '/exported_map.png'))

But it is giving me the below error
Warning: Error in .getNamespace: invalid type/length (symbol/0) in vector allocation

Same error as the discussion in this thread above, Can anyone explain what exactly is this error, then it would be helpful for me to fix it.

@mgm-cincy
Copy link

I was facing the same issue as aito123. I synced my maps in RStudio and from the Viewer tab zoomed to the maps. Then from the Viewer tab when I chose export I saw an option "Save as Web Page". I chose that option, and a stand alone html was created, which allowed me to zoom and use pop-up features in the html. I am using RStudio version 2022.07.01 Build 554.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants