We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
After much trial and error using code from issue #25, I can't get NA values in my raster to be transparent.
Here's example code. Option A uses addGeotiff and option B uses addRasterImage. Raster file available at: https://drive.google.com/file/d/1QbpOUPy_thsonsefdSZrEl2K1VDY0slw/view?usp=sharing
addGeotiff greatly improves raster load time for my application. I appreciate the work that's gone into development.
library(leaflet) library(leafem) library(raster) raster_path <- "C:/Users/Derek/Google Drive/RCrk/BSU_ScholorWorks_Archive/Pierson_RCrk_Soil-C-modeling_data/Spatial Data/Spatial forcing rasters/RCrk_MAST_estimate.tif" # Create leaflet map and set map location + zoom map <- leaflet() %>% addProviderTiles("Esri.WorldImagery", group = "Esri.WorldImagery", options = providerTileOptions(opacity = 1)) %>% setView(lng = -116.75, lat = 43.16, zoom = 11) # OPTION A ### Adding raster using addGeotiff map %>% addGeotiff(raster_path, colorOptions = colorOptions( palette = colorRampPalette(c("#05475e", "#faff78", "#ff9a00", "#ff3500"))(100) , breaks = c(5:15), na.color = "transparent"), opacity = 1, group = "MAST") # OPTION B ### Adding raster using addRasterImage # Load raster and make a color palette raster_img <- raster(raster_path) raster_vals <- values(raster_img) MAST_pal <- colorBin(palette = c("#05475e", "#faff78", "#ff9a00", "#ff3500"), domain = raster_vals, bins = c(5:15), pretty = TRUE, na.color = "transparent") # Add raster to map map %>% addRasterImage(raster_img, colors = MAST_pal, opacity = 1, group = "MAST")
The text was updated successfully, but these errors were encountered:
Thanks for spotting this. Should now work with the latest version from here.
Sorry, something went wrong.
Thank you for the quick fix! Works great now.
No branches or pull requests
After much trial and error using code from issue #25, I can't get NA values in my raster to be transparent.
Here's example code. Option A uses addGeotiff and option B uses addRasterImage.
Raster file available at: https://drive.google.com/file/d/1QbpOUPy_thsonsefdSZrEl2K1VDY0slw/view?usp=sharing
addGeotiff greatly improves raster load time for my application. I appreciate the work that's gone into development.
The text was updated successfully, but these errors were encountered: