diff --git a/DESCRIPTION b/DESCRIPTION index 130a77a..96582a3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -20,11 +20,11 @@ Imports: terra, raster, reshape2, - sf, - sp + sf Suggests: FedData (>= 3.0.2), soilDB (>= 2.5.7), + sp, utils, testthat (>= 3.0.0), spelling, diff --git a/R/extract_soils_NRCS_SDA.R b/R/extract_soils_NRCS_SDA.R index 0e29361..daf114a 100644 --- a/R/extract_soils_NRCS_SDA.R +++ b/R/extract_soils_NRCS_SDA.R @@ -470,6 +470,7 @@ fetch_mukeys_spatially_NRCS_SDA <- function( locations <- rSW2st::as_points(x, to_class = "sf", crs = crs) nxlocs <- nrow(locations) } else { + stopifnot(requireNamespace("sp")) locations <- rSW2st::as_points(x, to_class = "sp", crs = crs) nxlocs <- length(locations) } @@ -534,6 +535,7 @@ fetch_mukeys_spatially_NRCS_SDA <- function( as.vector(res_mukeys[ids, "mukey", drop = TRUE]) } else if (inherits(locations, "Spatial")) { + # sp is only used if soilDB < 2.6.10 sp::over( x = sp::spTransform( locations[ids_chunks[[k]], ],