Description Usage Arguments Value Author(s) Examples
This function apply morphology()
to raster objects.
1 2 3 4 5 6 7 8 9 10 11 | erodil_raster(raster, ...)
## S4 method for signature 'RasterLayer'
erodil_raster(
raster,
erosion = TRUE,
dilation = TRUE,
erosion_first = TRUE,
nt = 1,
...
)
|
raster |
An object of class RasterLayer containing NA values.
Note that as in the function |
... |
Further arguments passed to |
erosion |
A logical value indicating whether the data will be eroded or not. |
dilation |
A logical value indicating whether the data will be dilated or not. |
erosion_first |
A logical value indicating whether erosion should be carried out before dilation or vice versa. |
nt |
Number of times to be processed (passed to |
A RasterLayer object with value 1 for the processed features and NA for the background.
Jan Blöthe and Miguel Alvarez (kamapu78@gmail.com).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Load installed rasterLayer
require(raster)
r <- raster(file.path(path.package("spatialist"), "binras.tif"))
## Make only erosion or only dilation
plot(stack(list(original=r,
eroded=erodil_raster(r, dilation=FALSE),
dilated=erodil_raster(r, erosion=FALSE))))
## By default erosion will be done before dilation
plot(stack(list(original=r,
eroded_first=erodil_raster(r),
dilated_first=erodil_raster(r, erosion_first=FALSE),
both=erodil_raster(erodil_raster(r, erosion_first=FALSE)))))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.