Skip to content
R package for calculation of global illumination
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
man
tests
.Rbuildignore
.gitignore
DESCRIPTION
LICENSE
NAMESPACE
README.md
rasterShade.Rproj

README.md

rasterShade

The package rasterShade is just a wrapper around function in rayshader package. The rasterShade package allows using rayshader algorithm directly on spatial data in form of Raster. The package tries to set "reasonable" default values for parameters in rayshadering algorithm. These default values are based on real world shadows that can be seen in nature.

Installation

First you need to install rayshader package from GitHub. The description of this package can be found in this great blogpost and in this follow-up.

devtools::install_github("tylermorganwall/rayshader")

Then this package rasterShade can be installed:

devtools::install_github("JanCaha/rasterShade")

Example

Loading the libraries and preparing data:

library(raster)
library(rasterShade)

raster <- raster("digital_surface_model.tif")

Global shading raster:

shadow_raster <- shade_global(raster, date = "2018-05-23", sun_elevation = "noon", 
                              search_distance = 100)
                              
writeRaster(shadow_raster, "equinox_noon.tif", overwrite = TRUE)

Raster shading using lambert method:

shadow_raster <- shade_lambert(raster, only_facing_sun = TRUE, verbose = TRUE)

writeRaster(shadow_raster, "equinox_noon_lambert.tif", overwrite = TRUE)

Raster shading using ambient shadows:

shadow_raster <- shade_ambient(raster, date = "2018-05-23", sun_elevation = "noon", 
                               rays_number = 36, search_distance = 100)
                               
writeRaster(shadow_raster, "equinox_noon_ambient.tif", overwrite = TRUE)
You can’t perform that action at this time.