.locationCreate,character-method | R Documentation |
This function initializes a GRASS "project" (previously known in GRASS as a "location"; see vignette("projects_mapsets", package = "fasterRaster")
). You need to run this function (often just once) before you use most functions in fasterRaster. This function is of use to developers, not most users.
## S4 method for signature 'character'
.locationCreate(x, location = NULL, overwrite = FALSE, warn = TRUE)
## S4 method for signature 'SpatRaster'
.locationCreate(x, location = NULL, overwrite = FALSE, warn = TRUE)
## S4 method for signature 'SpatVector'
.locationCreate(x, location = NULL, overwrite = FALSE, warn = TRUE)
## S4 method for signature 'sf'
.locationCreate(x, location = NULL, overwrite = FALSE, warn = TRUE)
x |
Any object from which a coordinate reference system (CRS) can be acquired. Ergo, any of:
|
location |
Character or |
overwrite |
Logical: If |
warn |
Logical: If |
A GLocation object (invisibly).
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.