Skip to contents

Fetches soil properties from SoilGrids 2.0 (Poggio et al. 2021; about 250 m) for one or more depth intervals, plus the depth to bedrock from SoilGrids 2017 (Shangguan et al. 2017), for a region only: as with download_chelsa_monthly(), only the cells of extent are read from the global files over the internet (GDAL), and each layer is saved as a GeoTIFF in path. Values are converted to conventional units (pH, g/kg, %, cmol(c)/kg) with the factors of the SoilGrids documentation, and the carbon to nitrogen ratio is added. Existing files are kept, so an interrupted run continues where it stopped.

Usage

download_soilgrids(
  path,
  extent = NULL,
  vars = c("phh2o", "soc", "nitrogen", "cec", "clay", "sand", "silt"),
  depth = "0-5cm",
  stat = c("mean", "Q0.5", "Q0.05", "Q0.95", "uncertainty"),
  bedrock = TRUE,
  cn = TRUE,
  template = NULL,
  resolution = 1/480,
  prefix = "",
  overwrite = FALSE,
  base_url = "https://files.isric.org/soilgrids/latest/data",
  bedrock_url =
    "https://files.isric.org/soilgrids/former/2017-03-10/data/BDTICM_M_250m_ll.tif"
)

Arguments

path

Folder for the files (created if needed).

extent

Region: c(xmin, xmax, ymin, ymax) in degrees, a SpatExtent, or an sf / SpatVector / SpatRaster (its extent). Ignored when template is given.

vars

SoilGrids 2.0 properties (see Details).

depth

Depth interval(s), e.g. "0-5cm" (default) or c("0-5cm", "5-15cm").

stat

"mean" (default), "Q0.5" (median), "Q0.05", "Q0.95" or "uncertainty" (the 90% prediction interval divided by the median, x 10).

bedrock

Add the depth to bedrock (SoilGrids 2017)?

cn

Add the carbon to nitrogen ratio (needs soc and nitrogen)?

template

Optional raster whose grid (CRS, extent, resolution) the layers are warped onto, by averaging.

resolution

Cell size in degrees without template.

prefix

File name prefix.

overwrite

Download again existing files?

base_url, bedrock_url

Locations of the SoilGrids 2.0 folders and of the 2017 depth-to-bedrock file (change only for a mirror or a local copy).

Value

A SpatRaster of the downloaded layers, named <var>_<depth> (e.g. phh2o_0_5cm, cn_0_5cm, bedrock_depth), invisibly.

Details

Soil matters for plants and is missing from climate grids: in-situ soil chemistry (B-horizon C:N, exchangeable calcium) predicted forest understorey plants as well as topography did (Roe et al. 2022). Mapped soil properties are a weaker stand-in for such measurements: SoilGrids is itself a machine-learning prediction from soil profiles and covariates, with large uncertainty where profiles are few (use stat = "Q0.05" and "Q0.95", or "uncertainty", to see it), and exchangeable cations are not mapped. pH is a poor indicator of fertility in acidic soils (Roe et al. 2022); C:N, CEC and texture add to it.

Layers (vars): phh2o pH in water; soc organic carbon (g/kg); nitrogen total nitrogen (g/kg); cec cation exchange capacity at pH 7 (cmol(c)/kg); clay, sand, silt (%); bdod bulk density (kg/dm3); cfvo coarse fragments (vol%); ocd organic carbon density (kg/m3). cn is computed as soc / nitrogen when both are downloaded. bedrock adds the absolute depth to bedrock (cm; SoilGrids 2017 BDTICM), a single layer: in SoilGrids 2.0 it is not mapped.

Depths. SoilGrids 2.0 maps six intervals: 0-5, 5-15, 15-30, 30-60, 60-100 and 100-200 cm. The top one or two are the usual choice for plants with shallow roots; deeper intervals follow trees and deep-rooted shrubs.

Grid. By default the layers are warped from the Homolosine projection of SoilGrids to longitude/latitude at 7.5 arc-seconds (about 250 m). With template (e.g. one layer of your climate stack) they are warped directly onto its grid, averaging the 250 m cells, so they stack with the climate layers without further resampling.

Availability. The server (files.isric.org) is checked first; if it cannot be reached the function stops with an explanation, and a layer that fails half-way gives a warning and is fetched again on the next run.

Continuous layers only. All layers offered are continuous, so averaging onto a coarser template is appropriate; the categorical WRB soil classes are not offered because classes cannot be averaged. Depth intervals are never merged: download each interval you need and decide how to use them.

References

Poggio, L., de Sousa, L.M., Batjes, N.H., et al. (2021) SoilGrids 2.0: producing soil information for the globe with quantified spatial uncertainty. SOIL 7, 217-240. doi:10.5194/soil-7-217-2021

Roe, N.A., Ducey, M.J., Lee, T.D., et al. (2022) Soil chemical variables improve models of understorey plant species distributions. Journal of Biogeography 49, 753-766. doi:10.1111/jbi.14344

Shangguan, W., Hengl, T., Mendes de Jesus, J., Yuan, H., Dai, Y. (2017) Mapping the global depth to bedrock for land surface modeling. Journal of Advances in Modeling Earth Systems 9, 65-88. doi:10.1002/2016MS000686

See also

climate_index_names("soil", table = TRUE) for the layers, their units and sources; crop_rasters() to cut other layers to the same region.

Examples

# \donttest{
# pH, organic carbon, nitrogen and C:N of the top 5 cm, and bedrock
if (interactive()) {
  soil <- download_soilgrids("soil", extent = c(19.8, 20.2, 49.2, 49.4),
                             vars = c("phh2o", "soc", "nitrogen"))
  soil
}
# }