export_gis: Exports a 'MultiLand' object as GIS data

View source: R/export_gis.R

export_gisR Documentation

Exports a 'MultiLand' object as GIS data

Description

Exports points, buffers and intersections between buffers and rasterlayers, as shapefiles and raster files.

Usage

export_gis(
  x,
  raster = NULL,
  points = NULL,
  radii = NULL,
  ext_raster = NULL,
  dir = getwd(),
  filenames = c("points", "buffers", "lsm_raster", "ext_raster"),
  overwrite = FALSE,
  filetype = c("ESRI Shapefile", "GTiff"),
  gdal = c("COMPRESS=DEFLATE", "PREDICTOR=2", "ZLEVEL=9"),
  ...
)

Arguments

x

An object of class 'MultiLand' generated with mland().

raster, ext_raster

Numeric. The rasterlayers to be exported.

points

Numeric or character vector of points to be processed. See Details.

radii

Numeric vector of radii to be processed.

dir

Character. Name of the target directory where files will be exported. Provide a string with an existing folder, otherwise the function will create it.

filenames

Character vector with the root of the file names to be exported, for points, buffers, main rasterlayers and extra rasters, respectively. Default is c("points", "buffers", "lsm_raster", "ext_raster").

overwrite

Logical. Whether to overwrite (TRUE) or not (FALSE, default) existing files with the same names.

filetype

Character. File format expressed as GDAL driver names (Vector Drivers, Raster drivers). Default are c("ESRI Shapefile", "GTiff") for points/rasters and raster intersections, respectively.

gdal

GDAL driver specific datasource creation options. See the GDAL documentation. With the GeoTiff file format, export_gis() uses the following compression options: c("COMPRESS=DEFLATE", "PREDICTOR=2", "ZLEVEL=9").

...

Other arguments passed to terra::writeRaster.

Details

If argument points is a character vector, export_gis() will assume that the 'MultiLand' object inputted in argument x was created with site_ref = TRUE. This is, there is an attribute in points layer data with the names for each individual point. Therefore, the inputted values in argument points will be taken as these identification names. Otherwise, if a numeric vector is declared, the inputted values will be taken as the automatically generated point ids (created when running mland()).

Value

No return of an R object. GIS data from a 'MultiLand' object is exported.

See Also

mland()

Examples

## Not run: 
# Loads a 'MultiLand' object
ernesdesign <- system.file("extdata", "ernesdesign.zip", package = "multilandr")
ernesdesign <- load_mland(ernesdesign)

# Exports as GIS data
export_gis(ernesdesign, dir = "ernesdesign")

## End(Not run)

phuais/multilandR documentation built on Feb. 11, 2024, 9:27 p.m.