Ext.Check: Check extent specification

View source: R/Spatial.R

Ext.CheckR Documentation

Check extent specification

Description

Try to convert user input into (1) a terra or sf object and also read out the corresponding (2) SpatExtent object. Supports inputs of classes belonging to the packages raster, terra, sf, and sp

Usage

Ext.Check(USER_ext)

Arguments

USER_ext

User-supplied Extent argument in download_ERA function call

Value

A list containg (1) a terra/sf object and (2) the corresponding SpatExtent object.

Examples

## raster
Check.Ext(raster::extent(c(9.87, 15.03, 49.89, 53.06)))
## terra
Check.Ext(terra::ext(c(9.87, 15.03, 49.89, 53.06)))
## sf
set.seed(42)
nb_pt <- 10
dd <- data.frame(x = runif(nb_pt, 9.87, 15.03), y = runif(nb_pt, 49.89, 53.06), val = rnorm(nb_pt))
sf <- sf::st_as_sf(dd, coords = c("x", "y"))
Check.Ext(sf)
## sp
Check.Ext(as(sf, "Spatial"))


ErikKusch/KrigR documentation built on Feb. 17, 2025, 2:09 p.m.