.locations | R Documentation |
GRASS uses "locations"to store sets of rasters and vectors with the same coordinate reference system (CRS). These rasters and vectors may or may not be in the same actual location on Earth–they just have the same CRS. This function returns information on all of the GRASS "locations" that have been initialized. It is mainly useful for developers.
NB: fasterRaster always uses the "PERMANENT" mapset.
.locations(warn = TRUE)
warn |
Logical: If |
A named list
. The names are the "location's" names and the values are the coordinate reference strings.
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.