Saving Mapview Locally that have HTML Widget Popups
Hello! Hope everyone is having a great day. I'm sure this has already been addressed but I seem to have trouble saving my map as an html and having the pop ups that I created work.
Here is a quick example of an interactive pop up I made when I run the following
` #current directory is C:/Users/some_confused_guy_on_github/Desktop/Project Little Out There/Room Tax Interative
date_chosen <- "2020-12-01" # Select the date
county_names <- unique(data$Counties) # Obtain all unique county names from the data pop_up_collective <- list() # Make an empty list to hold plots county_index <- 1 # Make an index to help save plots in proper order html_paths <- c() # Create a list to store HTML file paths
Loop through each county to generate pop-ups
for (county in county_names) { print(county) # Print the current county being processed county_data <- subset(data, Counties == county) # Subset data for the current county pop_up_for_specific_county <- generate_pop_up(county_data, date_chosen, county) # Generate pop-up for the specific county print(pop_up_for_specific_county) # Print the pop-up (optional) path1 <- file.path("C:/Users/some_confused_guy_on_github/Desktop/Project Little Out There/popup_graphs_folder", paste0(county_index, "_popup.html")) # Define the file path to save the HTML file saveWidget(pop_up_for_specific_county, path1) # Save the pop-up as an HTML file pop_up_collective[[county_index]] <- pop_up_for_specific_county # Store the pop-up in the collective list html_paths <- c(html_paths, path) # Store the HTML file path in the list county_index <- county_index + 1 # Increment the county index }
images <- html_paths # Store the HTML paths in the images list (I tried doing something with this but couldn't seem to make it work)
#merged_df just has all the county location information and zcol gets the values from the date chosen
room_tax_inderactive_map <- mapview(merged_df, zcol = date_chosen, map.types = "CartoDB.Positron", popup = popupGraph(pop_up_collective, type = "html", height = 600, width = 600))
`
when I save the file locally however I get
Any advice/guidance is really appreciated and I apologize if this has already been solved. Thanks again :D
I think this is still an u resolved issue. I will have a look and get back to you as soon as I find the time.
Sounds good! Thank you @tim-salabim for your quick reply, in the meantime I hope your day goes smooth :)