Overlays an image (with a transparency layer) on the current map.
add_overlay( hillshade, overlay, alphacolor = NULL, alphamethod = "max", alphalayer = 1, rescale_original = FALSE )
hillshade | A three-dimensional RGB array or 2D matrix of shadow intensities. |
---|---|
overlay | A three or four dimensional RGB array, where the 4th dimension represents the alpha (transparency) channel. If the array is 3D, `alphacolor` should also be passed to indicate transparent regions. |
alphacolor | Default `NULL`. If `overlay` is a 3-layer array, this argument tells which color is interpretted as completely transparent. |
alphamethod | Default `max`. Method for dealing with pre-existing transparency with `layeralpha`. If `max`, converts all alpha levels higher than `layeralpha` to the value set in `layeralpha`. Otherwise, this just sets all transparency to `layeralpha`. |
alphalayer | Default `1`. Defines minimum tranparaency of layer. If transparency already exists in `overlay`, the way `add_overlay` combines the two is determined in argument `alphamethod`. |
rescale_original | Default `FALSE`. If `TRUE`, `hillshade` will be scaled to match the dimensions of `overlay` (instead of the other way around). |
Hillshade with overlay.
#Combining base R plotting with rayshader's spherical color mapping and raytracing: # \dontrun{ montereybay %>% sphere_shade() %>% add_overlay(height_shade(montereybay),alphalayer = 0.6) %>% add_shadow(ray_shade(montereybay,zscale=50)) %>% plot_map()#> Warning: no function found corresponding to methods exports from ‘raster’ for: ‘wkt’# } #Add contours with `generate_contour_overlay()` montereybay %>% height_shade() %>% add_overlay(generate_contour_overlay(montereybay)) %>% add_shadow(ray_shade(montereybay,zscale=50)) %>% plot_map()#> Warning: replacing previous import ‘vctrs::data_frame’ by ‘tibble::data_frame’ when loading ‘dplyr’