| .crop | R Documentation |
crop wrapperThis function is a simple tryCatch wrapper for crop. The function attempts to crop a spatial layer, x, by an extent object. If this proceedure fails, the function throws a warning and returns NULL; otherwise x is cropped and returned.
.crop(x, ext, layer = c("raster", "polygon", "line", "paths", "points"))
x |
A Raster or Spatial* object. |
ext |
An |
layer |
A character that defines the spatial layer type. This is used to produce an informative warning message if necessary. |
This function is designed to support pretty_map and associated funtions.
The function returns x cropped by ext or NULL with a warning if the cropping routine throws an error.
Edward Lavender
## Not run:
# Success
.crop(dat_gebco, raster::extent(dat_gebco), layer = "raster")
# Failure
.crop(sp::SpatialPoints(cbind(1:10, 1:10)), raster::extent(dat_gebco), layer = "raster")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.