.mapset,GLocation-method | R Documentation |
GRASS "locations" are sets of one or more rasters and/or vectors with the same coordinate reference systems, and may or may not represent the same actual location on Earth. GRASS "mapsets" are like subfolders of locations, and are collections of rasters and/or vectors typically related to the same general project. This function returns the mapset of an object or the current mapset. This said, fasterRaster always uses the "PERMANENT" mapset, so there is very little reason to use this function as-is. See vignette("projects_mapsets", package = "fasterRaster")
.
## S4 method for signature 'GLocation'
.mapset(x)
## S4 method for signature 'missing'
.mapset(x)
x |
A Either:
|
A character string.
GRASS locations and mapsets
if (grassStarted()) {
# Setup
library(terra)
# Example data
madElev <- fastData("madElev")
madChelsa <- fastData("madChelsa")
madChelsa1 <- madChelsa[[1]]
# Convert SpatRasters to GRasters.
# Each raster has a different CRS so will be put into a different location.
elev <- fast(madElev)
chelsa1 <- fast(madChelsa1)
# Name of the currently active location
if (FALSE) {
.location()
.location(elev)
.location(chelsa1)
# All available GRASS locations
.locations()
# Find location of an object among all active locations
.locationFind(elev)
.locationFind(chelsa1)
.locationFind(chelsa1, return = "index")
.locationFind(chelsa1, return = "crs")
# Switch between locations
.locationRestore(elev)
.locationRestore(chelsa1)
loc <- .location(elev)
.locationRestore(loc)
# Delete the location where "elev" is stored.
if (FALSE) .locationDelete(elev) # dangerous!
# Mapsets are always "PERMANENT" in fasterRaster
.mapset()
.mapset(elev)
.mapset(chelsa1)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.