Learn R Programming

medfate (version 2.2.1)

soilgridsParams: SoilGrids soil description fetcher

Description

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

Usage

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

Arguments

points

An object of class (or subclass) SpatialPoints 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.soilgrids.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<U+0107> A, et al. (2017) SoilGrids250m: Global gridded soil information based on machine learning. PLoS ONE 12(2): e0169748. doi:10.1371/journal.pone.0169748.

See Also

soil, defaultSoilParams

Examples

Run this code
# NOT RUN {
  coords_sp <- SpatialPoints(cbind(long = -5.6333, lat = 42.6667), 
                             CRS("+proj=longlat +datum=WGS84"))
  foo <- soilgridsParams(coords_sp, widths = c(300, 700, 1000))
  foo_soil <- soil(foo)
  foo_soil
# }

Run the code above in your browser using DataLab