Learn R Programming

sits (version 1.1.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 som_map sits_view( x, ..., label, prob_max = 1, prob_min = 0.7, legend = NULL, palette = "Harmonic" )

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

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

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

# 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", "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.

label

Label from the SOM map to be shown.

prob_max

Maximum a posteriori probability for SOM neuron samples to be shown

prob_min

Minimum a posteriori probability for SOM neuron samples 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.

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,
        parse_info = c("X1", "X2", "tile", "band", "date")
    )
    # get the timeline
    timeline <- sits_timeline(modis_cube)
    # view the data cube
    sits_view(modis_cube,
        band = "NDVI",
        dates = timeline[[1]]
    )

    samples_ndvi <- sits_select(samples_modis_4bands,
        bands = c("NDVI")
    )
    rf_model <- sits_train(samples_ndvi, sits_rfor())

    modis_probs <- sits_classify(
        data = modis_cube,
        ml_model = rf_model,
        output_dir = tempdir(),
        memsize = 4,
        multicores = 1
    )
    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]]
    )
}

Run the code above in your browser using DataLab