Learn R Programming

soilDB (version 2.5.9)

fetchSoilGrids: Fetch SoilGrids 250m properties information from point locations

Description

This function obtains SoilGrids properties information (250m raster resolution) given a data.frame containing site IDs, latitudes and longitudes.

Usage

fetchSoilGrids(locations, loc.names = c("id", "lat", "lon"))

Arguments

locations

A data.frame containing 3 columns referring to site ID, latitude and longitude.

loc.names

Optional: Column names referring to site ID, latitude and longitude. Default: c("id","lat","lon")

Value

A SoilProfileCollection

Details

The depth intervals returned are: "0-5cm", "5-15cm", "15-30cm", "30-60cm", "60-100cm", "100-200cm" and the properties returned are "bdod", "cec", "cfvo", "clay", "nitrogen", "phh2o", "sand", "silt", "soc" -- each with 5th, 50th, 95th, mean and uncertainty values. Point data requests are made through properties/query endpoint of the SoilGrids v2.0 REST API: https://rest.soilgrids.org/soilgrids/v2.0/docs

Examples

Run this code
# NOT RUN {
 if(requireNamespace("curl") &
   curl::has_internet()) {
  
  library(aqp)

  your.points <- data.frame(id  = c("A", "B"), 
                           lat = c(37.9, 38.1), 
                           lon = c(-120.3, -121.5), 
                           stringsAsFactors = FALSE)

  x <- fetchSoilGrids(your.points)
 
  plotSPC(x, name = NA, color = "socQ50")
 }
# }

Run the code above in your browser using DataLab