get_soil_data: Executes the full soil extraction process

Description Usage Arguments Value Note Examples

View source: R/get_soil_data.R

Description

Executes the full soil extraction process

Usage

1
2
3
get_soil_data(df, lat_col = NULL, lon_col = NULL, country_iso,
  soil_layers = c("ph", "carbon", "soil_texture", "sand", "silt", "clay",
  "CEC", "p", "n"), raw_data_directory, country_polygon_directory)

Arguments

df

set of GPS points for which the user wants an export

lat_col

the latitude column in the data

lon_col

the longitude column in the data

country_iso

The country in which these points are located to trim down the data.

soil_layers

The soil variables the user wants returned in the dataframe for those soil points. The soil layers need to be one of the following: c(ph, carbon, soil_texture, sand, silt, clay, CEC, nitrogen) which are soil ph, carbon, soil texture, sand content, silt content, clay content, CEC, and soil nitrogen

raw_data_directory

The location where the data are located to know where to get the raw tif. This defaults to the current working directory.

country_polygon_directory

The file directory with the country polygon files. These are available for download with the get_country_polygon() function

Value

The original spdf data frame along with the extracted soil layers.

Note

This function assumes the data remain named what they are when they're down loaded from the soil grids website. The units for the soil parameters are available on the repo website, https://github.com/one-acre-fund/soilgrids, as well as listed out here: pH - standard pH scale. Carbon (SOC) - g/kg. Nitrogen - mg/kg. Phosphorous - mg/kg. CEC - cmolc/kg. sand, silt, clay -

Examples

1
2
get_soil_data(spdf = gps.data, country.iso = "KEN", raw_data_directory, country_polygon_directory)
country_iso = c("KEN", "RWA", "BDI", "TZA", "UGA", "ZMB", "MWI", "ETH", "IND", "NGA")

one-acre-fund/soilgrids documentation built on Feb. 14, 2019, 1:30 p.m.