0

I am using the package mapview to plot a 3D raster cube from a raster stack.

> S2_images
class       : RasterStack 
dimensions  : 660, 1074, 708840, 6  (nrow, ncol, ncell, nlayers)
resolution  : 10, 10  (x, y)
extent      : 219800, 230540, 4097480, 4104080  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=30 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 
names       : L2A_T30ST//51_B02_10m, L2A_T30ST//51_B03_10m, L2A_T30ST//51_B04_10m, L2A_T30ST//51_B08_10m, L2A_T30ST//51_B11_20m, L2A_T30ST//51_B12_20m 
min values  :                     1,                   127,                     6,                     1,                    88,                    86 
max values  :                  8702,                  9090,                  7589,                  7322,                  5379,                  5474 

With cubeview(S2_images) I get this visualization with default colors:

enter image description here

My objective is to plot it using RGB colours. For reference, I have created an RGB composition using plotRGB

plotRGB(S2_images, r=3, g=2, b=1, scale=maxValue(S2_images[[1]]), stretch="lin")

According to ?cubeview, col.regiosn should be color (palette).See levelplot for details. Any idea how to proceed to create a color palette out of the RGB composition that I can use as input in the cubeview?

enter image description here

GCGM
  • 901
  • 1
  • 17
  • 38
  • Disclaimer: mapview developer here. What exactly are you trying to do? What is your data - a 6 band satellite image? `cubeview` is intended to flick through layers, when plotting RGB images you're essentially using the information of 3 layers combined to produce a color representation instead of mapping colors to data of one layer directly. mapview also has `viewRGB` which is essentially an interactive version of `plotRGB`. Is this what you want? – TimSalabim Feb 09 '19 at 10:59
  • The data is a `stack` of two multispectral images (3 bands - red blud green - each). The idea would be to merge the 3D capabilities of `cubeview` with the color display of `plotRGB` or `viewRGB`. Basically, take a `raster stack`, visualize it in 3D using `cubeview` and use the three RGB layers to produce a color representation. Not sure if it is possible with the actual implementatio of `cubeview` – GCGM Feb 12 '19 at 14:14
  • 1
    That's currently not possible, sorry. – TimSalabim Feb 12 '19 at 16:21

0 Answers0