Skip to contents

Creates a local copy of the latest 'MLRA Geographic Database' in the user's package data cache. This file/directory is separate from the package installation.

Usage

cache_lrrmlra_geometry(
  overwrite = FALSE,
  dsn =
    "/vsizip//vsicurl/https://www.nrcs.usda.gov/sites/default/files/2022-10/MLRA_52_2022.zip/MLRA_52_2022"
)

clear_lrrmlra_geometry()

lrrmlra_geometry(
  overwrite = FALSE,
  dsn =
    "/vsizip//vsicurl/https://www.nrcs.usda.gov/sites/default/files/2022-10/MLRA_52_2022.zip/MLRA_52_2022"
)

Source

The default source is a ZIP file containing an ESRI Shapefile. The direct download URL is https://www.nrcs.usda.gov/sites/default/files/2022-10/MLRA_52_2022.zip, which can be found here.

Arguments

overwrite

Overwrite existing file? Passed to terra::writeVector(). Default: FALSE

dsn

Path to a geospatial data source. Default path uses GDAL Virtual File Systems to access and decompress remote source ("/vsizip//vsicurl/https://www.nrcs.usda.gov/sites/default/files/2022-10/MLRA_52_2022.zip/MLRA_52_2022").

Value

cache_lrrmlra_geometry(): logical. Called for the side-effect of adding the MLRA geometry file to the cache. Returns TRUE if the "lrrmlra.gpkg" file exists in the user's "data" cache directory.

clear_lrrmlra_geometry(): logical. Called for the side-effect of removing the MLRA geometry file from the cache. Returns TRUE if "lrrmlra.gpkg" is successfully removed from user data cache.

lrrmlra_geometry(): A terra SpatVector object containing lrrmlra attributes and geometry.

References

United States Department of Agriculture, Natural Resources Conservation Service. 2022. Land resource regions and major land resource areas of the United States, the Caribbean, and the Pacific Basin. U.S. Department of Agriculture, Agriculture Handbook 296. Available online: https://www.nrcs.usda.gov/resources/data-and-reports/major-land-resource-area-mlra

See also

Examples

if (FALSE) {
 library(terra)

 # download (if needed) and load geometry
 x <- lrrmlra_geometry()
 plot(x)

 # clear cache
 clear_lrrmlra_geometry()

 # download and cache (without loading)
 cache_lrrmlra_geometry()
}