get_OSD: Get Official Series Description Data from JSON, HTML or TXT...

View source: R/get_OSD.R

get_OSDR Documentation

Get Official Series Description Data from JSON, HTML or TXT sources

Description

Get Official Series Description Data from JSON, HTML or TXT sources

Usage

get_OSD(
  series,
  base_url = NULL,
  result = c("json", "html", "txt"),
  fix_ocr_errors = FALSE,
  verbose = FALSE
)

get_OSD_JSON(series, base_url = NULL)

Arguments

series

A character vector of Official Series names e.g. "Chewacla"

base_url

Optional: alternate JSON/HTML/TXT repository path. Default: NULL uses "https://github.com/ncss-tech/SoilKnowledgeBase" for result="json"

result

Select "json", "html", or "txt" output

fix_ocr_errors

Default: FALSE; Applies only to result='json'. Convert clear cases of Optical Character Recognition (OCR) errors to likely actual values.

verbose

Print errors and warning messages related to HTTP requests? Default: FALSE

Details

The default base_url for result="json" is to JSON files stored in a GitHub repository that is regularly updated from the official source of Series Descriptions. Using format: ⁠https://raw.githubusercontent.com/ncss-tech/SoilKnowledgeBase/main/inst/extdata/OSD/{LETTER}/{SERIES}.json⁠ for JSON. And ⁠"https://soilseriesdesc.sc.egov.usda.gov/OSD_Docs/{LETTER}/{SERIES}.html⁠ is for result="html" (official source).

fix_ocr_errors by default is turned off (FALSE). When TRUE, assume that in color data hue/value/chroma lowercase "L" ("l") is a 1, and a capital "O" is interpreted as zero. Also, in horizon designations assume lowercase "L" is a 1, and a string that starts with 0 starts with the capital letter "O".

Value

For JSON result: A data.frame with 1 row per series, and 1 column per "section" in the OSD as defined in National Soil Survey Handbook. For TXT or HTML result a list of character vectors containing OSD text with 1 element per series and one value per line.

Examples




  series <- c("Musick", "Hector", "Chewacla")
  get_OSD(series)


soilDB documentation built on Sept. 11, 2024, 8:28 p.m.