fetchHWSD | R Documentation |
Creates a local cache of FAO Harmonized World Soil Database (HWSD) information. Source raster map in ESRI Grid format (.bil) is converted to GeoTIFF. The source tabular database in Microsoft Access (.mdb) format is converted to SQLite.
fetchHWSD(
x = NULL,
hwsd_url = "https://s3.eu-west-1.amazonaws.com/data.gaezdev.aws.fao.org/HWSD/",
hwsd_version = 2L,
force = FALSE
)
get_HWSD_path(what = c("sqlite", "mdb", "raster", "path"), hwsd_version = 2L)
x |
A SpatRaster, SpatVector, SpatExtent, or any other object that has
a SpatExtent. Default |
hwsd_url |
character. URL for downloading HWSD dataset. Default
|
hwsd_version |
integer. Default |
force |
Force rebuilding of cache. Default: |
what |
character. One of "sqlite", "raster", or "path" |
A SpatRaster object with mapunit-level aggregate information stored as categories.
Food and Agriculture Organization of the United Nations (FAO), Soils Portal, Harmonized World Soil Database (HWSD) v2.0 https://www.fao.org/soils-portal/data-hub/soil-maps-and-databases/harmonized-world-soil-database-v20/en/
## Not run:
x <- terra::vect(system.file("ex", "lux.shp", package = "terra"))
res <- fetchHWSD(x)
# categorical data (WRB class)
terra::activeCat(res) <- "WRB4"
# view WRB4 map
terra::plot(res)
terra::lines(x, col = "white")
# convert categories containing numeric data to numeric values
res2 <- terra::catalyze(res)
# view AWC map
terra::plot(res2$AWC, main = "Available Water Capacity, mm")
terra::lines(x, col = "white")
# access tabular data from cached SQLite database
SDA_query("SELECT * FROM HWSD2_SMU LIMIT 1", dsn = get_HWSD_path())
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.