View source: R/coord_to_raster.R
coord_to_raster | R Documentation |
Given a set of x-y coordinates, this function will return a raster with a single cell at those coordinates.
coord_to_raster(outlets, which, out, overwrite = FALSE)
outlets |
The name of a set of sites in the current GRASS mapset. |
which |
A numeric identifier for the site to convert to raster. |
out |
The file name of the output outlet raster in the current GRASS mapset. |
overwrite |
Whether the output files should be allowed to overwrite existing files. Defaults to |
This function is exposed to the user, and users are welcome to use if convenient for them, this function is intended for internal use in other functions.
Nothing.
# Will only run if GRASS is running
if(check_running()){
# Load data set
dem <- system.file("extdata", "dem.tif", package = "rdwplus")
sts <- system.file("extdata", "sites.shp", packages = "rdwplus")
# Set environment parameters
set_envir(dem)
# Read in sites
vector_to_mapset(sts)
# Convert first site to raster
coord_to_raster("site", 1, "coords", overwrite = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.