clusterOutputToTerraVector: Convert cluster output to terra vector

View source: R/clusterOutputToTerraVector.R

clusterOutputToTerraVectorR Documentation

Convert cluster output to terra vector

Description

Enriches land use data on cluster resolution with explicit spatial information by creating a terra polygon for each cluster according to the given clustermap.

Usage

clusterOutputToTerraVector(x, clustermap)

Arguments

x

Landuse data on cluster/cell resolution as a magclass object

clustermap

A dataframe mapping with columns cluster, cell, and country

Value

A SpatVector with the following columns: c("clusterId", "country", "region", "year", "landtype", "value")

Author(s)

Pascal Führlich, Patrick v. Jeetze

Examples

## Not run: 
landUse <- magpie4::land("fulldata.gdx", level = "cell")
clustermap <- readRDS(Sys.glob("clustermap_*.rds"))
clusterPolygons <- magpie4::clusterOutputToTerraVector(landUse, clustermap)
terra::writeVector(clusterPolygons, "cluster_resolution.shp")

## End(Not run)


pik-piam/magpie4 documentation built on April 27, 2024, 2:12 p.m.