sits_as_sf: Return a sits_tibble or raster_cube as an sf object.

View source: R/sits_sf.R

sits_as_sfR Documentation

Return a sits_tibble or raster_cube as an sf object.

Description

Return a sits_tibble or raster_cube as an sf object.

Usage

sits_as_sf(data, ..., as_crs = NULL)

## S3 method for class 'sits'
sits_as_sf(data, ..., crs = "EPSG:4326", as_crs = NULL)

## S3 method for class 'raster_cube'
sits_as_sf(data, ..., as_crs = NULL)

Arguments

data

A sits tibble or sits cube.

...

Additional parameters.

as_crs

Output coordinate reference system.

crs

Input coordinate reference system.

Value

An sf object of point or polygon geometry.

Author(s)

Felipe Carvalho, felipe.carvalho@inpe.br

Alber Sanchez, alber.ipia@inpe.br

Examples

if (sits_run_examples()) {
    # convert sits tibble to an sf object (point)
    sf_object <- sits_as_sf(cerrado_2classes)

    # convert sits cube to an sf object (polygon)
    data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
    cube <- sits_cube(
        source = "BDC",
        collection = "MOD13Q1-6.1",
        data_dir = data_dir
    )
    sf_object <- sits_as_sf(cube)
}

sits documentation built on Sept. 11, 2024, 6:36 p.m.