Learn R Programming

sits (version 1.4.0)

sits_view: 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 sits sits_view(x, ..., legend = NULL, palette = "Harmonic")

# S3 method for data.frame sits_view(x, ..., legend = NULL, palette = "Harmonic")

# S3 method for som_map sits_view(x, ..., id_neurons, legend = NULL, palette = "Harmonic")

# S3 method for raster_cube sits_view( x, ..., band = NULL, red = NULL, green = NULL, blue = NULL, tiles = x$tile, dates = NULL, class_cube = NULL, legend = NULL, view_max_mb = NULL, palette = "RdYlGn" )

# S3 method for uncertainty_cube sits_view( x, ..., tiles = x$tile, class_cube = NULL, legend = NULL, view_max_mb = NULL, palette = "Blues" )

# S3 method for class_cube sits_view( x, ..., tiles = NULL, legend = NULL, palette = "default", view_max_mb = NULL )

# S3 method for probs_cube sits_view( x, ..., tiles = x$tile, class_cube = NULL, legend = NULL, view_max_mb = NULL, palette = "YlGnBu" )

# S3 method for default sits_view(x, ...)

Value

A leaflet object containing either samples or data cubes embedded in a global map that can be visualized directly in an RStudio viewer.

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

Palette provided in the configuration file.

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.

view_max_mb

Maximum size of leaflet to be visualized

Author

Gilberto Camara, gilberto.camara@inpe.br

Examples

Run this code
if (sits_run_examples()) {
    sits_view(cerrado_2classes)

    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())

    modis_probs <- sits_classify(
        data = modis_cube,
        ml_model = rf_model,
        output_dir = tempdir()
    )
    modis_label <- sits_label_classification(
        modis_probs,
        output_dir = tempdir()
    )

    sits_view(modis_label)

    sits_view(modis_cube,
        band = "NDVI",
        class_cube = modis_label,
        dates = sits_timeline(modis_cube)[[1]]
    )
    modis_uncert <- sits_uncertainty(
        cube = modis_probs,
        output_dir = tempdir()
    )
    sits_view(modis_uncert)
}

Run the code above in your browser using DataLab