write_raster {hillshader} | R Documentation |
Write hillshade to a file
Description
Write an array from a hillshade procedure to a geospatial raster file.
Usage
write_raster(hillshade, elevation, filename, format, ...)
Arguments
hillshade |
A 2D matrix of shadow intensities. |
elevation |
Original elevation raster. |
filename |
Character. Output filename. |
format |
Character. Output file type. Passed to |
... |
Additional arguments passed to |
Value
This function is used for the side-effect of writing values to a file.
Author(s)
Pierre Roudier
Examples
library(rayshader)
out_fn <- paste0(tempfile(), ".tif")
# Create elevation matrix
el_mat <- maungawhau %>%
raster_to_matrix()
el_mat %>%
# Create hillshade layer using
# ray-tracing
ray_shade() %>%
# Add ambient shading
add_shadow_2d(
ambient_shade(
heightmap = el_mat
)
) %>%
write_raster(
elevation = maungawhau,
filename = out_fn
)
[Package hillshader version 0.1.2 Index]