soilgridsParams takes a vector of depths and returns a list of soil characteristics ready to use with soil function.

soilgridsParams(x, widths = c(300, 700, 1000, 2000), verbose = FALSE)

Arguments

x

An object of class (or subclass) sf or sfc with a valid CRS definition.

widths

A numeric vector indicating the desired layer widths, in mm. If NULL the default soil grids layer definition is returned.

verbose

A logical flag to include a progress bar while processing the output of the query to the SoilGrids REST API.

Value

If only one point is supplied, a data frame containing the soil characteristics ready to use with the soil function. If more than one point is supplied, the function returns a list with as many elements as points, each one containing the mentioned list.

Details

This function connects with the SoilGrids REST API (https://rest.isric.org) to retrieve the soil physical and chemical characteristics for a site (Hengl et al. 2007), selected by its coordinates. Also, in case the depths are not the default ones in the SoilGrids API, the function uses averages the values of soil grid layers depending on the overlap between soil layer definitions. Input coordinates are transformed to longitude/latitude within the function.

References

Hengl T, Mendes de Jesus J, Heuvelink GBM, Ruiperez Gonzalez M, Kilibarda M, Blagotić A, et al. (2017) SoilGrids250m: Global gridded soil information based on machine learning. PLoS ONE 12(2): e0169748. doi:10.1371/journal.pone.0169748.

Author

Víctor Granda, EMF-CREAF

Miquel De Cáceres Ainsa, EMF-CREAF

Examples

 if (FALSE) {
  library(sf)
  coords_sf <- st_sfc(st_point(c(-5.6333, 42.6667)), crs = 4326)
  foo <- soilgridsParams(coords_sf, widths = c(300, 700, 1000))
  foo_soil <- soil(foo)
  foo_soil
 }