Learn R Programming

rdwplus (version 0.1.0)

coord_to_raster: Turn coordinates of outlets into rasters

Description

Given a set of coordinates in space (x, y), this function will return a rasterised version of that point in space.

Usage

coord_to_raster(outlet, out, overwrite = FALSE)

Value

Nothing.

Arguments

outlet

A single pair of Easting, Northing or long, lat coordinates as a numeric vector.

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 FALSE.

Examples

Run this code
# Will only run if GRASS is running
if(check_running()){
# Load data set
dem <- system.file("extdata", "dem.tif", package = "rdwplus")

# Set environment parameters
set_envir(dem)

# Read in data
raster_to_mapset(dem)

# Set coordinates to rasterise
coord_df <-  c(1098671, 6924794)

# Convert to raster
coord_to_raster(outlet = coord_df, out = "coords", overwrite = TRUE)

# Plot
plot_GRASS("dem.tif", col = topo.colors(15))
plot_GRASS("coords", col = "red", add = TRUE)
}

Run the code above in your browser using DataLab