-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
42 lines (42 loc) · 1.25 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
## Load important libraries
library(terra)
## Load raster data
# The raster data for this example is a cloud optimized geotiff
s2 <- rast('https://storage.googleapis.com/rsssa-bucket/sen2_srSwell_2015-2020.tif')
# inspect raster names in the s2 stack
names(s2)
# Get the min/max values from the raster stack. This is needed to display the RGB composite image
setMinMax(s2)
# plot a R,G,B view of the composite image
plotRGB(s2,
r = 'red',
g = 'green',
b = 'blue')
# It can be helpful to apply a linear or histogram equalization stretch of the SpatRaster to aid in visualization.
# apply a linear stretch
plotRGB(s2,
r = 'red',
g = 'green',
b = 'blue',
stretch = 'lin') # 'hist'
#For a smoother visual output, set smooth option = TRUE.
plotRGB(s2,
r = 'swir2',
g = 'nir',
b = 'green',
stretch = "lin",
smooth = T)
## Load important libraries
library(terra)
## Load raster data
# The raster data for this example is a cloud optimized geotiff
s2 <- rast('https://storage.googleapis.com/rsssa-bucket/sen2_srSwell_2015-2020.tif')
# inspect raster names in the s2 stack
names(s2)
# Get the min/max values from the raster stack. This is needed to display the RGB composite image
setMinMax(s2)
# plot a R,G,B view of the composite image
plotRGB(s2,
r = 'red',
g = 'green',
b = 'blue')