Create a Red-Green-Blue image overlay from a RasterStack
/
RasterBrick
or stars
object based on three layers.
Three layers (sometimes referred to as "bands" because they may represent
different bandwidths in the electromagnetic spectrum) are combined such
that they represent the red, green and blue channel. This function can
be used to make 'true (or false) color images' from Landsat and other
multi-band satellite images. Note, this text is plagirized, i.e. copied
from plotRGB
.
AddRasterRGB
and addStarsRGB
are aliases.
Arguments
- map
a map widget object created from `leaflet()``
- x
a `RasterBrick`, `RasterStack` or `stars`` raster object
- r
integer. Index of the Red channel/band, between 1 and nlayers(x)
- g
integer. Index of the Green channel/band, between 1 and nlayers(x)
- b
integer. Index of the Blue channel/band, between 1 and nlayers(x)
- quantiles
the upper and lower quantiles used for color stretching. If set to NULL, stretching is performed basing on `domain` argument.
- domain
the upper and lower values used for color stretching. This is used only if `quantiles` is NULL. If both `domain` and `quantiles` are set to NULL, stretching is applied based on min-max values.
- na.color
the color to be used for NA pixels
- ...
additional arguments passed on to
addRasterImage
Examples
# \donttest{
require(raster)
require(stars)
#> Loading required package: stars
#> Loading required package: abind
#> Loading required package: sf
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1; sf_use_s2() is TRUE
require(plainview)
#> Loading required package: plainview
require(leaflet)
leaflet() %>%
addTiles(group = "OpenStreetMap") %>%
addRasterRGB(plainview::poppendorf, 4,3,2, group = "True colours") %>%
addStarsRGB(st_as_stars(plainview::poppendorf), 5,4,3, group = "False colours") %>%
addLayersControl(
baseGroups = c("Satellite"),
overlayGroups = c("True colours", "False colours"),
)
#> Warning: CRS object has no comment
#> Warning: Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
#> Warning: Discarded datum World Geodetic System 1984 in Proj4 definition
#> Warning: CRS object has no comment
#> Warning: Using PROJ not WKT2 strings
#> Warning: CRS object has no comment
#> Warning: Using PROJ not WKT2 strings
#> Warning: Using PROJ not WKT2 strings
#> Warning: CRS object has no comment
#> Warning: Using PROJ not WKT2 strings
# }