sits_view {sits} | R Documentation |
View data cubes and samples in leaflet
Description
Uses leaflet to visualize time series, raster cube and classified images
Usage
sits_view(x, ...)
## S3 method for class 'sits'
sits_view(x, ..., legend = NULL, palette = "Harmonic")
## S3 method for class 'data.frame'
sits_view(x, ..., legend = NULL, palette = "Harmonic")
## S3 method for class 'som_map'
sits_view(x, ..., id_neurons, legend = NULL, palette = "Harmonic")
## S3 method for class 'raster_cube'
sits_view(
x,
...,
band = NULL,
red = NULL,
green = NULL,
blue = NULL,
tiles = x[["tile"]],
dates = NULL,
class_cube = NULL,
legend = NULL,
palette = "RdYlGn",
opacity = 0.7
)
## S3 method for class 'vector_cube'
sits_view(
x,
...,
band = NULL,
red = NULL,
green = NULL,
blue = NULL,
tiles = x[["tile"]],
dates = NULL,
class_cube = NULL,
legend = NULL,
palette = "RdYlGn",
opacity = 0.7,
seg_color = "black",
line_width = 1
)
## S3 method for class 'uncertainty_cube'
sits_view(
x,
...,
tiles = x[["tile"]],
class_cube = NULL,
legend = NULL,
palette = "Blues",
opacity = 0.7
)
## S3 method for class 'class_cube'
sits_view(
x,
...,
tiles = x[["tile"]],
legend = NULL,
palette = "Spectral",
opacity = 0.8
)
## S3 method for class 'probs_cube'
sits_view(
x,
...,
tiles = x[["tile"]],
class_cube = NULL,
legend = NULL,
opacity = 0.7,
palette = "YlGnBu"
)
## Default S3 method:
sits_view(x, ...)
Arguments
x |
Object of class "sits", "data.frame", "som_map", "raster_cube" or "classified image". |
... |
Further specifications for sits_view. |
legend |
Named vector that associates labels to colors. |
palette |
Color palette (if colors not in legend nor in sits default colors) |
id_neurons |
Neurons from the SOM map to be shown. |
band |
For plotting grey images. |
red |
Band for red color. |
green |
Band for green color. |
blue |
Band for blue color. |
tiles |
Tiles to be plotted (in case of a multi-tile cube). |
dates |
Dates to be plotted. |
class_cube |
Classified cube to be overlayed on top on image. |
opacity |
Opacity of segment fill or class cube |
seg_color |
Color for segment boundaries |
line_width |
Line width for segments (in pixels) |
Value
A leaflet object containing either samples or data cubes embedded in a global map that can be visualized directly in an RStudio viewer.
Note
Please refer to the sits documentation available in <https://e-sensing.github.io/sitsbook/> for detailed examples.
Author(s)
Gilberto Camara, gilberto.camara@inpe.br
Examples
if (sits_run_examples()) {
# view samples
sits_view(cerrado_2classes)
# create a local data cube
data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
modis_cube <- sits_cube(
source = "BDC",
collection = "MOD13Q1-6",
data_dir = data_dir
)
# view the data cube
sits_view(modis_cube,
band = "NDVI"
)
# train a model
rf_model <- sits_train(samples_modis_ndvi, sits_rfor())
# classify the cube
modis_probs <- sits_classify(
data = modis_cube,
ml_model = rf_model,
output_dir = tempdir()
)
# generate a map
modis_label <- sits_label_classification(
modis_probs,
output_dir = tempdir()
)
# view the classified map
sits_view(modis_label)
# view the classified map with the B/W image
sits_view(modis_cube,
band = "NDVI",
class_cube = modis_label,
dates = sits_timeline(modis_cube)[[1]]
)
# view the classified map with the RGB image
sits_view(modis_cube,
red = "NDVI", green = "NDVI", blue = "NDVI",
class_cube = modis_label,
dates = sits_timeline(modis_cube)[[1]]
)
# create an uncertainty cube
modis_uncert <- sits_uncertainty(
cube = modis_probs,
output_dir = tempdir()
)
# view the uncertainty cube
sits_view(modis_uncert)
}