View source: R/spatial_tools.R
crop_from_click | R Documentation |
raster
Interactively crop a raster
to a boundary box specified by mouse clicks.
crop_from_click(x, plot = TRUE, ...)
x |
A |
plot |
A logical input that defines whether or not to plot |
... |
Additional arguments passed to |
The function is implemented as follows:
The function plots the supplied raster (x
), if plot = TRUE
;
Boundary coordinates delineating the area to which x
should be cropped are defined by mouse clicks on the plot;
The plotted raster is cropped using the minimum and maximum x and y coordinates of mouse clicks, via crop
;
The cropped raster is plotted, if plot = TRUE
;
The cropped raster is returned.
The function returns a raster
and, if plot = TRUE
, a plot of the area before/after cropping.
Edward Lavender
if (interactive()) crop_from_click(dat_gebco)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.