Title: | Download Geographic Data |
---|---|
Description: | Functions for downloading of geographic data for use in spatial analysis and mapping. The package facilitates access to climate, crops, elevation, land use, soil, species occurrence, accessibility, administrative boundaries and other data. |
Authors: | Robert J. Hijmans [cre, aut], Márcia Barbosa [ctb], Aniruddha Ghosh [ctb], Alex Mandel [ctb] |
Maintainer: | Robert J. Hijmans <[email protected]> |
License: | GPL (>=3) |
Version: | 0.6-2 |
Built: | 2024-08-24 05:46:02 UTC |
Source: | https://github.com/rspatial/geodata |
Functions for downloading of geographic data for use in spatial analysis and mapping. The package facilitates access to climate, crops, elevation, land use, soil, species occurrence, accessibility, administrative boundaries and other data.
Function | Description |
bio_oracle |
Marine data from bio-oracle |
cmip6_world |
Downscaled and calibrated CMIP6 projected future climate data |
cmip6_tile |
Downscaled and calibrated CMIP6 data by tile |
country_codes
|
Country codes |
crop_calendar_sacks
|
Sachs crop calendar data |
crop_monfreda
|
Monfreda crop data (area, yield) |
crop_spam |
SPAM crop data (area, yield, value) |
cropland
|
Cropland density for the world from three sources |
elevation_3s |
Elevation data for tile (3 seconds resolution) |
elevation_30s |
Elevation data for by country (30 seconds resolution) |
elevation_global |
Global elevation data (various resolutions) |
gadm |
Administrative boundaries for any country in the world |
world
|
Boundaries for the countries in the world |
landcover |
Global landcover data |
footprint |
Human footprint data |
osm |
OpenStreetMap data by country |
population
|
Download population density data |
soil_af |
Chemical and physical soil properties data for Africa for different soil depths |
soil_af_water |
Physical soil properties for Africa for water balance computations |
soil_af_elements |
Soil element concentration data for Africa |
soil_af_isda |
Soil data for Africa derived from the iDSA data set |
soil_world_vsi |
Virtually connect to the global soilgrids data |
soil_world |
Global soils data |
sp_occurrence
|
Species occurrence data from the Global Biodiversity Information Facility |
travel_time
|
Travel time to cities and ports |
worldclim_global
|
Global climate data |
worldclim_country
|
Climate data by country |
worldclim_tile |
Climate data by tile |
Marine data from Bio-Oracle
bio_oracle(path, var, stat, benthic=FALSE, depth="Mean", time="Present", rcp, ...)
bio_oracle(path, var, stat, benthic=FALSE, depth="Mean", time="Present", rcp, ...)
path |
character. Path for storing the downloaded data. See |
var |
character. Variable of interest. One of 'Calcite', 'Chlorophyll', 'Cloud.cover', 'Current.Velocity', 'Diffuse.attenuation', 'Dissolved.oxygen', 'Ice.cover', 'Ice.thickness', 'Iron', 'Light.bottom', 'Nitrate', 'Par', 'pH', 'Phosphate', 'Phytoplankton', 'Primary.productivity', 'Salinity', 'Silicate', 'Temperature' |
stat |
character. Statistic of interest. One of 'Lt.max', 'Lt.min', 'Max', 'Mean', 'Min', 'Range'. It should be "" if |
benthic |
logical. If |
depth |
character. Either "Min", "Mean", or "Max". Only relevant if |
time |
character. Either "Present", "2150" or "2100" |
rcp |
character. Either "26", "45", "60", or "85" |
... |
additional arguments passed to |
SpatRaster
Assis, J., Tyberghein, L., Bosh, S., Verbruggen, H., Serrão, E.A., & De Clerck, O. (2017). Bio-ORACLE v2.0: Extending marine data layers for bioclimatic modelling. Global Ecology and Biogeography 27: 277-284.
# this is a large download x <- bio_oracle(path=tempdir(), "Salinity", "Max", benthic=TRUE, depth="Mean", time="Present")
# this is a large download x <- bio_oracle(path=tempdir(), "Salinity", "Max", benthic=TRUE, depth="Mean", time="Present")
Download downscaled and calibrated CMIP6 climate data for projected future climates. Either for the entire world or for a 30 degrees tile. For more information see https://www.worldclim.org/
cmip6_world(model, ssp, time, var, res, path, ...) cmip6_tile(lon, lat, model, ssp, time, var, path, ...)
cmip6_world(model, ssp, time, var, res, path, ...) cmip6_tile(lon, lat, model, ssp, time, var, path, ...)
model |
character. Climate model abbrevation. One of "ACCESS-CM2", "ACCESS-ESM1-5", "AWI-CM-1-1-MR", "BCC-CSM2-MR", "CanESM5", "CanESM5-CanOE", "CMCC-ESM2", "CNRM-CM6-1", "CNRM-CM6-1-HR", "CNRM-ESM2-1", "EC-Earth3-Veg", "EC-Earth3-Veg-LR", "FIO-ESM-2-0", "GFDL-ESM4", "GISS-E2-1-G", "GISS-E2-1-H", "HadGEM3-GC31-LL", "INM-CM4-8", "INM-CM5-0", "IPSL-CM6A-LR", "MIROC-ES2L", "MIROC6", "MPI-ESM1-2-HR", "MPI-ESM1-2-LR", "MRI-ESM2-0", "UKESM1-0-LL" |
ssp |
character. A valid Shared Socio-economic Pathway code: "126", "245", "370" or "585". |
time |
character. A valid time period. One of "2021-2040", "2041-2060", or "2061-2080" |
var |
character. Valid variables names are "tmin", "tmax", "tavg", "prec" and "bioc" |
res |
numeric. Valid resolutions are 10, 5, 2.5 (minutes of a degree) |
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
lon |
numeric. Longitude |
lat |
numeric. Latitude |
SpatRaster
vrt
to combine tiles
# download of large files takes a while tmin10 <- cmip6_world("CNRM-CM6-1", "585", "2061-2080", var="tmin", res=10, path=tempdir())
# download of large files takes a while tmin10 <- cmip6_world("CNRM-CM6-1", "585", "2061-2080", var="tmin", res=10, path=tempdir())
Get country codes for all countries in the world.
country_codes(query=NULL)
country_codes(query=NULL)
query |
character. A single word that can be used to subset the returned data.frame |
data.frame
cc <- country_codes() head(cc) p <- country_codes(query="Per") p
cc <- country_codes() head(cc) p <- country_codes(query="Per") p
Download Sacks crop calendar data. The crops available are returned by sacksCrops
crop_calendar_sacks(crop="", path, ...) sacksCrops()
crop_calendar_sacks(crop="", path, ...) sacksCrops()
crop |
character. Crop name. See |
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
SpatRaster
Sacks, W.J., D. Deryng, J.A. Foley, and N. Ramankutty, 2010. Crop planting dates: an analysis of global patterns. Global Ecology and Biogeography 19: 607-620. doi:10.1111/j.1466-8238.2010.00551.x.
https://sage.nelson.wisc.edu/data-and-models/datasets/crop-calendar-dataset/
# download may take > 5s cas <- crop_calendar_sacks("cassava", path=tempdir())
# download may take > 5s cas <- crop_calendar_sacks("cassava", path=tempdir())
Monfreda global crop data (area, yield) for 175 crops.
Data may be freely used for research, study, or teaching, but must be cited appropriately (see below). Re-release of the data, or incorporation of the data into a commercial product, is allowed only with explicit permission.
monfredaCrops() crop_monfreda(crop="", var="area_ha", path, ...)
monfredaCrops() crop_monfreda(crop="", var="area_ha", path, ...)
crop |
character. Crop name(s). See |
var |
character. The variable(s) of interest. Choose from "area_ha" (crop area in ha per cell), "area_f" (crop area as a fraction of each cell), "area_q" (quality of the crop area data), "yield" (crop yield in Mg/ha), "yield_q" (quality of the yield data), "prod" (production per grid cell in Mg), or "all" |
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
SpatRaster
Monfreda, C., N. Ramankutty, and J. A. Foley (2008), Farming the planet: 2. Geographic distribution of crop areas, yields, physiological types, and net primary production in the year 2000, Global Biogeochem. Cycles, 22, GB1022, doi:10.1029/2007GB002947.
http://www.earthstat.org/harvested-area-yield-175-crops/
# download may take > 5s mcas <- crop_monfreda("cassava", path=tempdir()) mcas names(mcas)
# download may take > 5s mcas <- crop_monfreda("cassava", path=tempdir()) mcas names(mcas)
SPAM crop data. For each of 42 crops or crop groups get a 10-minute spatial resolution raster with the crop area, yield, production or value by cropping system (rainfed or irrigated, and subsistence, low-input or high-input).
The global data are for 2010. The Africa dataset is for 2017.
spamCrops() crop_spam(crop="", var="area", path, africa=FALSE, ...)
spamCrops() crop_spam(crop="", var="area", path, africa=FALSE, ...)
crop |
character. See |
var |
character. variable of interest. Must be one of "yield", "harv_area" (harvested area), "phys_area" (physical area), "prod" (production) or "val_prod" (value of production) |
path |
character. Path for storing the downloaded data. See |
africa |
logical. retrieve the (more up to date) data for Africa instead of global data |
... |
additional arguments passed to |
SpatRaster
International Food Policy Research Institute, 2019. Global Spatially-Disaggregated Crop Production Statistics Data for 2010 Version 2.0. https://doi.org/10.7910/DVN/PRFF8V, Harvard Dataverse, V4.
International Food Policy Research Institute, 2020. Spatially-Disaggregated Crop Production Statistics Data in Africa South of the Sahara for 2017. https://doi.org/10.7910/DVN/FSSKBW, Harvard Dataverse, V3.
https://www.mapspam.info/data/
# downloads a large file cas <- crop_spam("cassava", "area", path=tempdir(), TRUE)
# downloads a large file cas <- crop_spam("cassava", "area", path=tempdir(), TRUE)
Cropland distribution data at a 30-seconds spatial resolution from three sources:
worldcover
is derived from the ESA WorldCover data set at 0.3-seconds resolution. (License CC BY 4.0), see https://esa-worldcover.org/en. Values were aggregated and represent the fraction cropland in each cell.
glad
is derived from the "Global cropland expansion in the 21st century" (Potatov et al) data available here. Values were aggregated and resampled. They represent the fraction cropland in each cell. There are five layers representing the following years: 2003, 2007, 2011, 2015, and 2019.
QED
has cropland distribution data for Africa. The values are probabilities of cropland presence estimated with a neural network that was trained on an initial 1-million point Geosurvey conducted in 2015. License: CC-BY-SA 4.0; https://about.maps.qed.ai/
cropland(source, path, year, ...)
cropland(source, path, year, ...)
source |
character. One of "WorldCover", "GLAD", or "QED" |
path |
character. Path for storing the downloaded data. See |
year |
numeric. Optional for the GLAD dataset to get data for a single year. One of 2003, 2007, 2011, 2015, and 2019 |
... |
additional arguments passed to |
SpatRaster
WorldCover: Zanaga, D., Van De Kerchove, R., De Keersmaecker, W., Souverijns, N., Brockmann, C., Quast, R., Wevers, J., Grosu, A., Paccini, A., Vergnaud, S., Cartus, O., Santoro, M., Fritz, S., Georgieva, I., Lesiv, M., Carter, S., Herold, M., Li, Linlin, Tsendbazar, N.E., Ramoino, F., Arino, O., 2021. ESA WorldCover 10 m 2020 v100. doi:10.5281/zenodo.5571936.
GLAD: Potapov, P., S. Turubanova, M.C. Hansen, A. Tyukavina, V. Zalles, A. Khan, X.-P. Song, A. Pickens, Q. Shen, J. Cortez, 2021. Global maps of cropland extent and change show accelerated cropland expansion in the twenty-first century. Nature Food. doi:10.1038/s43016-021-00429-z
Elevation data for any country. The main data source is Shuttle Radar Topography Mission (SRTM) , specifically the hole-filled CGIAR-SRTM (90 m resolution) from https://srtm.csi.cgiar.org/. These data are only available for latitudes between -60 and 60.
The 1 km (30 arc seconds) data were aggregated from SRTM 90 m resolution data and supplemented with the GTOP30 data for high latitudes (>60 degrees).
elevation_3s(lon, lat, path, ...) elevation_30s(country, path, mask=TRUE, subs="", ...) elevation_global(res, path, ...)
elevation_3s(lon, lat, path, ...) elevation_30s(country, path, mask=TRUE, subs="", ...) elevation_global(res, path, ...)
lon |
numeric. Longitude |
lat |
numeric. Latitude |
path |
character. Path for storing the downloaded data. See |
country |
character. Country name or code |
mask |
logical. set grid cells outside of the country boundaries to NA |
subs |
character |
res |
numeric. Valid resolutions are 10, 5, 2.5, and 0.5 (minutes of a degree) |
... |
additional arguments passed to |
SpatRaster
be <- elevation_30s(country="BEL", path=tempdir() )
be <- elevation_30s(country="BEL", path=tempdir() )
The "human footprint" is an estimate of the direct and indirect human pressures on the environment. The human pressure is measured using eight variables including built-up environments, population density, electric power infrastructure, crop lands, pasture lands, roads, railways, and navigable waterways. It is expressed on a scale of 0 (low) to 50 (high footprint).
See https://www.nature.com/articles/sdata201667 for the details.
The original data are available here:
https://sedac.ciesin.columbia.edu/data/collection/wildareas-v3
Data are available for two years: 1993 and 2009, for all terrestrial areas except Antarctica. The footprint of seas and oceans was set to zero. The original data was in the Mollweide projection at a 1000 m spatial resolution. The data available through this function was transformed to a longitude/latitude grid at 30-seconds resolution.
Users are free to use, copy, distribute, transmit, and adapt the work for commercial and non-commercial purposes, without restriction, as long as clear attribution of the source is provided.
footprint(year=2009, path, ...)
footprint(year=2009, path, ...)
year |
character. "1993" or "2009" |
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
SpatRaster
Venter, O., E. W. Sanderson, A. Magrach, J. R. Allan, J. Beher, K. R. Jones, H. P. Possingham, W. F. Laurance, P. Wood, B. M. Fekete, M. A. Levy, and J. E. Watson. 2016. Sixteen Years of Change in the Global Terrestrial Human Footprint and Implications for Biodiversity Conservation. Nature Communications 7:12558. https://doi.org/10.1038/ncomms12558.
Get administrative boundaries for any country in the world. Data are read from files that are downloaded if necessary.
gadm(country, level=1, path, version="latest", resolution=1, ...)
gadm(country, level=1, path, version="latest", resolution=1, ...)
country |
character. Three-letter ISO code or full country name. If you provide multiple names they are all downloaded and |
level |
numeric. The level of administrative subdivision requested. (starting with 0 for country, then 1 for the first level of subdivision) |
path |
character. Path for storing the downloaded data. See |
version |
character. Either "latest" or GADM version number (can be "3.6", "4.0" or "4.1") |
resolution |
integer indicating the level of detail. Only for version 4.1. It should be either 1 (high) or 2 (low) |
... |
additional arguments passed to |
The data are from https://gadm.org
SpatVector
bel <- gadm(country="BEL", level=1, path=tempdir())
bel <- gadm(country="BEL", level=1, path=tempdir())
This function allows you set or get the default download path for the geodata package. By setting this path you can avoid downloading the same data many times over. This also guards against website service interruptions.
The default path is ignored if you use the path variable in a function.
To save the default path across sessions, you can add a line like this:
options( geodata_default_path = "c:/your/geodata/path")
to the file returned by
file.path( R.home(), "etc/Rprofile.site")
Alternatively, you can also set a system variable "GEODATA_PATH" to the desired path.
geodata_path(path)
geodata_path(path)
path |
character. Path name where the data should be downloaded to. If missing, the current default path is returned |
character
geodata_path()
geodata_path()
Landcover data at 30-seconds spatial resolution for (most of) the world. Values are the fraction of a landcover class in each cell. The values are derived from the ESA WorldCover data set at 0.3-seconds resolution. (License CC BY 4.0). See https://esa-worldcover.org/en for more information.
landcover(var, path, ...)
landcover(var, path, ...)
var |
character. One of "trees", "grassland", "shrubs", "cropland", "built", "bare", "snow", "water", "wetland", "mangroves", "moss" |
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
SpatRaster
Zanaga, D., Van De Kerchove, R., De Keersmaecker, W., Souverijns, N., Brockmann, C., Quast, R., Wevers, J., Grosu, A., Paccini, A., Vergnaud, S., Cartus, O., Santoro, M., Fritz, S., Georgieva, I., Lesiv, M., Carter, S., Herold, M., Li, Linlin, Tsendbazar, N.E., Ramoino, F., Arino, O., 2021. ESA WorldCover 10 m 2020 v100. doi:10.5281/zenodo.5571936.
Get OpenStreetMap (OSM) data
osm(country, var, path, proxy=FALSE, ...)
osm(country, var, path, proxy=FALSE, ...)
country |
character. Three-letter ISO code or full country name |
var |
character. Currently it can be one of "places", "highways", or "railway" |
path |
character. Path for storing the downloaded data. See |
proxy |
logical. Return a SpatVectorProxy? |
... |
additional arguments passed to |
License: Open Data Commons Open Database License (ODbL).
See https://www.openstreetmap.org/copyright
SpatVector
aruba <- osm(country="Aruba", "places", path=tempdir())
aruba <- osm(country="Aruba", "places", path=tempdir())
Download population density data.
Source: Gridded Population of the World (GPW), v4. Documentation:
http://sedac.ciesin.columbia.edu/data/collection/gpw-v4/documentation
population(year, res, path, ...)
population(year, res, path, ...)
year |
numeric. One of 2000, 2005, 2010, 2015, 2020 |
res |
numeric. Valid resolutions are 10, 5, 2.5, and 0.5 (minutes of a degree) |
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
SpatRaster
Center for International Earth Science Information Network - CIESIN - Columbia University. 2018. Gridded Population of the World, Version 4 (GPWv4): Population Density, Revision 11. Palisades, NY: NASA Socioeconomic Data and Applications Center (SEDAC). doi:10.7927/H49C6VHW. Accessed 6 July 2021.
# download may take > 5s pop <- population(2020, 10, path=tempdir())
# download may take > 5s pop <- population(2020, 10, path=tempdir())
Get crop calendar and production data for rice
rice_calendar(path, ...)
rice_calendar(path, ...)
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
SpatVectorCollection
Laborte, A.G.; Gutierrez, M.A.; Balanza, J.G.; Saito, K.; Zwart, S.J.; Boschetti, M.; Murty, MVR; Villano, L.; Aunario, J.K.; Reinke, R.; Koo, J.; Hijmans, R.J.; Nelson, A., 2017. RiceAtlas, a spatial database of global rice calendars and production. Scientific Data 4: 170074 doi:10.1038/sdata.2017.74
# first time api call takes a while rice <- rice_calendar(path=tempdir()) cal <- rice[1]
# first time api call takes a while rice <- rice_calendar(path=tempdir()) cal <- rice[1]
Download chemical soil properties data for Africa for different soil depths. The spatial resolution is 30 arc-seconds (about 1 km2), aggregated from the original 250m resolution.
There are more recent estimations for some of the properties available in other data sets. See soil_af_isda
and soil_world
.
For more info, see https://www.isric.org/projects/soil-property-maps-africa-250-m-resolution
The data have a CC-BY 4.0 NC license
soil_af(var, depth, path, ...)
soil_af(var, depth, path, ...)
var |
character. Variables name such as "pH" or "clay". See Details |
depth |
numeric. One of |
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
var | description | unit | |
clay | Soil texture fraction clay | % | |
sand | Soil texture fraction sand | % | |
silt | Soil texture fraction silt | % | |
coarse | Coarse fragments volumetric | % | |
SOC | Organic carbon | g kg-1 (‰) | |
BLKD | Bulk density (fine earth) | kg m-3 | |
poros | Porosity (volum. fraction) based on PTF | - | |
AWpF2.0 | Avail. soil water capacity (vol. frac.) for FC = pF 2.0 | - | |
AWpF2.3 | Avail. soil water capacity (vol. frac.) for FC = pF 2.3 | - | |
AWpF2.5 | Avail. soil water capacity (vol. frac.) for FC = pF 2.4 | - | |
AWpF4.2 | Avail. soil wat. cap. (vol. frac.) at wilting point (pF 4.2) | - | |
BDR | Depth to bedrock | cm | |
. | . | . | |
pH | pH (H2O) | - | |
ECN | Electrical conductivity | mS/m (?) | |
acid-exch | Exchangeable acidity | cmol(+) kg-1 | |
bases-exch | Sum of exchangeable bases | cmol(+) kg-1 | |
CEC | Cation Exchange Capacity | cmol(+) kg-1 | |
Al-extr | Extractable Aluminum (Mehlich 3) | mg kg-1 (ppm) | |
Al-exch | Exchangeable Aluminum | cmol(+) kg-1 | |
Ca-exch | Exchangeable Calcium | cmol(+) kg-1 | |
K-exch | Exchangeable Potassium | cmol(+) kg-1 | |
Mg-exch | Exchangeable Magnesium | cmol(+) kg-1 | |
Na-exch | Exchangeable Sodium | cmol(+) kg-1 | |
Ntot | Total nitrogen | g kg-1 | |
SpatRaster
Hengl T, Heuvelink GBM, Kempen B, Leenaars JGB, Walsh MG, Shepherd KD, et al. (2015) Mapping Soil Properties of Africa at 250 m Resolution: Random Forests Significantly Improve Current Predictions. PLoS ONE 10(6): e0125814. doi:10.1371/journal.pone.0125814
soil_af_elements
, soil_af_isda
, soil_world_vsi
# downloads a large file aph <- soil_af(var="ph", depth=5, path=tempdir())
# downloads a large file aph <- soil_af(var="ph", depth=5, path=tempdir())
Connect to or download chemical soil element concentration (for the 0-30 cm topsoil) data for Africa. The spatial resolution is 30 arc-seconds (about 1 km2), aggregated from the original 250 m spatial resolution.
The data have an Open Data Commons Open Database License (ODbL)
For more information, see https://www.isric.org/projects/soil-property-maps-africa-250-m-resolution
soil_af_elements(var, path, ...)
soil_af_elements(var, path, ...)
var |
character. Variables name. One of: "Al", "B", "Ca", "Cu", "Fe", "K", "Mg", "Mn", "N", "Na", "P", "Ptot", "Zn". See Details |
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
var | description | unit | |
Al | Extractable aluminum | mg kg-1 (ppm) | |
B | Extractable boron | mg kg-1 (ppm) | |
Ca | Extractable calcium | mg kg-1 (ppm) | |
Cu | Extractable copper | mg kg-1 (ppm) | |
Fe | Extractable iron | mg kg-1 (ppm) | |
K | Extractable potassium | mg kg-1 (ppm) | |
Mg | Extractable magnesium | mg kg-1 (ppm) | |
Mn | Extractable manganese | mg kg-1 (ppm) | |
N | Organic nitrogen | mg kg-1 (ppm) | |
Na | Extractable sodium | mg kg-1 (ppm) | |
P | Extractable phosphorus | mg (100 kg-1) | |
Ptot | Total phosphorus | mg (100 kg-1) | |
Zn | Extractable zinc | mg kg-1 (ppm) | |
SpatRaster
Hengl T, Heuvelink GBM, Kempen B, Leenaars JGB, Walsh MG, Shepherd KD, et al. (2015) Mapping Soil Properties of Africa at 250 m Resolution: Random Forests Significantly Improve Current Predictions. PLoS ONE 10(6): e0125814. doi:10.1371/journal.pone.0125814
soil_af
, soil_af_isda
, soil_world
# downloads a large file fe <- soil_af_elements("Fe", path=tempdir(), quiet=TRUE)
# downloads a large file fe <- soil_af_elements("Fe", path=tempdir(), quiet=TRUE)
Download soil data for Africa derived from the iDSA data set. The original data were aligned and aggregated to 30 arc-seconds (about 1 km2). The original spatial resolution was 30m.
For more info see:
https://envirometrix.nl/isdasoil-open-soil-data-for-africa/
https://zenodo.org/search?page=1&size=20&q=iSDAsoil
soil_af_isda(var, depth=20, error=FALSE, path, virtual=FALSE, ...)
soil_af_isda(var, depth=20, error=FALSE, path, virtual=FALSE, ...)
var |
character. The variables name, one of: "Al", "bdr", "clay", "C.tot", "CEC", "Ca", "db.od", "eCEC.f", "Fe", "K", "Mg", "N.tot", "oc", "P", "pH.H2O", "sand", "silt", "S", "texture", "wpg2", "Zn".see Details |
depth |
numeric. One of 20 (for 0-20 cm) and 50 (for 20-50 cm). Ignored if |
error |
logical. If |
path |
character. Path for storing the downloaded data. See |
virtual |
logical. If |
... |
additional arguments passed to |
var | description | unit | |
Al | extractable aluminum | mg kg-1 | |
bdr | bed rock depth | cm | |
clay | clay content | % | |
C.tot | total carbon | kg-1 | |
Ca | extractable calcium | mg kg-1 | |
db.od | bulk density | kg m-3 | |
eCEC.f | effective cation exchange capacity | cmol(+) kg-1 | |
Fe | extractable iron | mg kg-1 | |
K | extractable potassium | mg kg-1 | |
Mg | extractable magnesium | mg kg-1 | |
N.tot | total organic nitrogen | g kg-1 | |
OC | Organic Carbon | g kg-1 | |
P | Phosphorus content | mg kg-1 | |
pH.H2O | pH (H2O) | - | |
sand | Sand content | % | |
silt | Silt content | % | |
S | Extractable sulfer | mg kg-1 | |
texture | texture class | - | |
wpg2 | stone content | % | |
Zn | Extractable zinc | mg kg-1 | |
SpatRaster
Tomislav Hengl, Matthew A. E. Miller, Josip Križan, Keith D. Shepherd, Andrew Sila, Milan Kilibarda, Ognjen Antonijevic, Luka Glušica, Achim Dobermann, Stephan M. Haefele, Steve P. McGrath, Gifty E. Acquah, Jamie Collinson, Leandro Parente, Mohammadreza Sheykhmousa, Kazuki Saito, Jean-Martial Johnson, Jordan Chamberlin, Francis B.T. Silatsa, Martin Yemefack, John Wendt, Robert A. MacMillan, Ichsani Wheeler & Jonathan Crouch, 2021. African soil properties and nutrients mapped at 30 m spatial resolution using two-scale ensemble machine learning. Scientific Reports 11: 6130.
soil_af_elements
, soil_af
, soil_world
# downloads a large file afph <- soil_af_isda("ph.h2o", path=tempdir(), quiet=TRUE)
# downloads a large file afph <- soil_af_isda("ph.h2o", path=tempdir(), quiet=TRUE)
Virtually connect to the iSDA soil data for Africa. The spatial of these data is 30m.
For more info see:
https://envirometrix.nl/isdasoil-open-soil-data-for-africa/
https://zenodo.org/search?page=1&size=20&q=iSDAsoil
soil_af_isda_vsi(var)
soil_af_isda_vsi(var)
var |
character. The variables name, one of: "Al", "bdr", "clay", "C.tot", "CEC", "Ca", "db.od", "eCEC.f", "Fe", "K", "Mg", "N.tot", "oc", "P", "pH.H2O", "sand", "silt", "S", "texture", "wpg2", "Zn".see Details |
var | description | unit | |
Al | extractable aluminum | mg kg-1 | |
bdr | bed rock depth | cm | |
clay | clay content | % | |
C.tot | total carbon | kg-1 | |
Ca | extractable calcium | mg kg-1 | |
db.od | bulk density | kg m-3 | |
eCEC.f | effective cation exchange capacity | cmol(+) kg-1 | |
Fe | extractable iron | mg kg-1 | |
K | extractable potassium | mg kg-1 | |
Mg | extractable magnesium | mg kg-1 | |
N.tot | total organic nitrogen | g kg-1 | |
OC | Organic Carbon | g kg-1 | |
P | Phosphorus content | mg kg-1 | |
pH.H2O | pH (H2O) | - | |
sand | Sand content | % | |
silt | Silt content | % | |
S | Extractable sulfer | mg kg-1 | |
texture | texture class | - | |
wpg2 | stone content | % | |
Zn | Extractable zinc | mg kg-1 | |
SpatRaster
Tomislav Hengl, Matthew A. E. Miller, Josip Križan, Keith D. Shepherd, Andrew Sila, Milan Kilibarda, Ognjen Antonijevic, Luka Glušica, Achim Dobermann, Stephan M. Haefele, Steve P. McGrath, Gifty E. Acquah, Jamie Collinson, Leandro Parente, Mohammadreza Sheykhmousa, Kazuki Saito, Jean-Martial Johnson, Jordan Chamberlin, Francis B.T. Silatsa, Martin Yemefack, John Wendt, Robert A. MacMillan, Ichsani Wheeler & Jonathan Crouch, 2021. African soil properties and nutrients mapped at 30 m spatial resolution using two-scale ensemble machine learning. Scientific Reports 11: 6130.
soil_af_elements
, soil_af_isda
, soil_world
Download physical soil properties data for Africa that can be used in water balance computation. The values are for a soil depth of 0 to 30 cm. The spatial resolution is 30 arc-seconds (about 1 km2), aggregated from the original 250m resolution.
For other properties see soil_af
, soil_af_elements
, soil_af_isda
.
For more info, see https://www.isric.org/projects/soil-property-maps-africa-250-m-resolution
The data have a CC-BY 4.0 NC license
soil_af_water(var, depth = "30cm", path, ...)
soil_af_water(var, depth = "30cm", path, ...)
var |
character. Variables name such as "awcpf23" or "pwp". See Details |
depth |
character. Either "30cm" or "erzd" (the effective rooting zone depth of maize) |
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
var | description | unit | |
awcpf23 | Available water capacity of the fine earth at field capacity (pF 2.3) | volumetric % | |
pwp | Moisture content of the fine earth at permanent wilting point (pF 4.2) | volumetric % | |
tetas | Moisture content of the fine earth at saturation | volumetric % | |
tawcpf23 | Absolute total available water capacity | cm? | |
tawcpf23mm | Absolute total available water capacity in mm | mm | |
erzd | Effective root zone depth (for maize) | cm | |
SpatRaster
soil_af_elements
, soil_af_isda
, soil_world
# this downloads a large file tetaS <- soil_af_water(var="tetas", depth="erzd", path=tempdir())
# this downloads a large file tetaS <- soil_af_water(var="tetas", depth="erzd", path=tempdir())
Download global soils data. The data are derived from the SoilGRIDS database. The data were aggregated and transformed to a longitude/latitude coordinate reference system with 30-second spatial resolution.
See https://www.isric.org/explore/soilgrids for more info.
data license: CC-BY 4.0
soil_world(var, depth, stat="mean", name="", path, ...)
soil_world(var, depth, stat="mean", name="", path, ...)
var |
character. Variables name. One of: "bdod", "cfvo", "clay", "nitrogen", "ocd", "ocs", "phh2o", "sand", "silt", "soc", "wrb". See Details |
depth |
numeric. One of |
stat |
character. One of "mean", "uncertainty", "Q0.05", "Q0.5", "Q0.95". Ignored if |
name |
character. One of "Acrisols", "Albeluvisols", "Alisols", "Andosols", "Arenosols", "Calcisols", "Cambisols", "Chernozems", "Cryosols", "Durisols", "Ferralsols", "Fluvisols", "Gleysols", "Gypsisols", "Histosols", "Kastanozems", "Leptosols", "Lixisols", "Luvisols", "Nitisols", "Phaeozems", "Planosols", "Plinthosols", "Podzols", "Regosols", "Solonchaks", "Solonetz", "Stagnosols", "Umbrisols", "Vertisols". Only used when |
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
var | description | unit | |
bdod |
Bulk density of the fine earth fraction | kg dm-3 | |
cec |
Cation Exchange Capacity of the soil | cmol(+) kg-1 | |
cfvo |
Vol. fraction of coarse fragments (> 2 mm) | % | |
nitrogen |
Total nitrogen (N) | g kg-1 | |
phh2o |
pH (H2O) | - | |
sand |
Sand (> 0.05 mm) in fine earth | % | |
silt |
Silt (0.002-0.05 mm) in fine earth | % | |
clay |
Clay (< 0.002 mm) in fine earth | % | |
soc |
Soil organic carbon in fine earth | g kg-1 | |
ocd |
Organic carbon density | kg m-3 | |
ocs |
Organic carbon stocks | kg m-2 | |
SpatRaster
Poggio L., de Sousa L.M., Batjes N.H., Heuvelink G.B.M., Kempen B., Ribeiro E., Rossiter D., 2021. SoilGrids 2.0: producing soil information for the globe with quantified spatial uncertainty. Soil 7:217-240, 2021. doi:10.5194/soil-7-217-2021
For virtual access to the original data: soil_world_vsi
For Africa: soil_af_isda
, soil_af
, soil_af_elements
# this downloads a large file gph <- soil_world(var="phh2o", depth=5, path=tempdir())
# this downloads a large file gph <- soil_world(var="phh2o", depth=5, path=tempdir())
Virtually connect to the global soilgrids data. See https://www.isric.org/explore/soilgrids for more info.
data license: CC-BY 4.0
soil_world_vsi(var, depth, stat="mean", name="")
soil_world_vsi(var, depth, stat="mean", name="")
var |
character. Variables name. One of: "bdod", "cfvo", "clay", "nitrogen", "ocd", "ocs", "phh2o", "sand", "silt", "soc", "wrb". See Details |
depth |
numeric. One of 5, 15, 30, 60, 100, 200. This is shorthand for the following depth ranges: 0-5, 5-15, 15-30, 30-60, 60-100, 100-200 cm. Ignored if |
stat |
character. One of "mean", "uncertainty", "Q0.05", "Q0.5", "Q0.95". Ignored if |
name |
character. One of 'Acrisols', 'Albeluvisols', 'Alisols', 'Andosols', 'Arenosols', 'Calcisols', 'Cambisols', 'Chernozems', 'Cryosols', 'Durisols', 'Ferralsols', 'Fluvisols', 'Gleysols', 'Gypsisols', 'Histosols', 'Kastanozems', 'Leptosols', 'Lixisols', 'Luvisols', 'Nitisols', 'Phaeozems', 'Planosols', 'Plinthosols', 'Podzols', 'Regosols', 'Solonchaks', 'Solonetz', 'Stagnosols', 'Umbrisols', 'Vertisols'. Only used when |
The below table lists the variable names, a description, and the units of the variables. Note that these units are not standard units, and are different from the data for other soil data available through this package.
var | description | unit | |
bdod |
Bulk density of the fine earth fraction | cg cm-3 | |
cec |
Cation Exchange Capacity of the soil | mmol(+) kg-1 | |
cfvo |
Vol. fraction of coarse fragments (> 2 mm) | ‰ | |
nitrogen |
Total nitrogen (N) | cg kg-1 | |
phh2o |
pH (H2O) | - | |
sand |
Sand (> 0.05 mm) in fine earth | ‰ | |
silt |
Silt (0.002-0.05 mm) in fine earth | ‰ | |
clay |
Clay (< 0.002 mm) in fine earth | ‰ | |
soc |
Soil organic carbon in fine earth | dg kg-1 | |
ocd |
Organic carbon density | hg m-3 | |
ocs |
Organic carbon stocks | hg m-2 | |
SpatRaster
Poggio, L., de Sousa, L.M., Batjes, N.H., Heuvelink, G.B.M., Kempen, B., Ribeiro, E., and Rossiter, D., 2021. SoilGrids 2.0: producing soil information for the globe with quantified spatial uncertainty. Soil 7:217-240, 2021. doi:10.5194/soil-7-217-2021
soil_world
to download these data at 30-seconds spatial resolution.
For Africa: soil_af_isda
, soil_af
, soil_af_elements
ph <- soil_world_vsi(var="phh2o", depth=5) ph
ph <- soil_world_vsi(var="phh2o", depth=5) ph
Download data from the Global Biodiversity Information Facility (GBIF) data portal.
sp_genus
returns a data.frame with all the species names associated with a genus.
sp_occurrence
downloads species occurrence records. You can download data for a single species or for an entire genus by using species=""
. Note that the maximum number of records that can be downloaded for a single search is 100,000.
You can check the number of records returned by using the option download=FALSE
.
To avoid getting more than 100,000 records, you can do separate queries for different geographic areas. This has been automated in sp_occurrence_split
. This function recursively splits the area of interest into smaller areas until the number of records in an area is less than 50,000. It then downloads these records and saves them in a folder called "gbif". After all areas have been evaluated, the data are combined into a single file and returned as a data.frame). If the function is interrupted, it can be run again, and it will resume where it left off.
If you want to download data for an entire genus, first run sp_genus
and then download data for the returned species names one by one.
Before using this function, please first check the GBIF data use agreement and see the note below about how to cite these data.
sp_genus(genus, simple=TRUE, ...) sp_occurrence(genus, species="", ext=NULL, args=NULL, geo=TRUE, removeZeros=FALSE, download=TRUE, ntries=5, nrecs=300, start=1, end=Inf, fixnames=TRUE, ...) sp_occurrence_split(genus, species="", path=".", ext=c(-180,180,-90,90), args=NULL, geo=TRUE, removeZeros=FALSE, ntries=5, nrecs=300, fixnames=TRUE, prefix=NULL, ...)
sp_genus(genus, simple=TRUE, ...) sp_occurrence(genus, species="", ext=NULL, args=NULL, geo=TRUE, removeZeros=FALSE, download=TRUE, ntries=5, nrecs=300, start=1, end=Inf, fixnames=TRUE, ...) sp_occurrence_split(genus, species="", path=".", ext=c(-180,180,-90,90), args=NULL, geo=TRUE, removeZeros=FALSE, ntries=5, nrecs=300, fixnames=TRUE, prefix=NULL, ...)
genus |
character. genus name |
species |
character. species name. Can be left blank to get the entire genus |
ext |
SpatExtent object to limit the geographic extent of the records. A SpatExtent can be created using functions like |
args |
character. Additional arguments to refine the query. See query parameters in http://www.gbif.org/developer/occurrence for more details |
geo |
logical. If |
removeZeros |
logical. If |
download |
logical. If |
ntries |
integer. How many times should the function attempt to download the data, if an invalid response is returned (perhaps because the GBIF server is very busy) |
nrecs |
integer. How many records to download in a single request (max is 300)? |
start |
integer. Record number from which to start requesting data |
end |
integer. Last record to request |
fixnames |
If |
path |
character. Where should the data be downloaded to (they will be put in a subdirectory "gbif")? |
prefix |
character. prefix of the downloaded filenames (best left NULL, the function will then use "genus_species" |
simple |
logical. If |
... |
additional arguments passed to |
data.frame
Under the terms of the GBIF data user agreement, users who download data agree to cite a DOI. Citation rewards data-publishing institutions and individuals and provides support for sharing open data [1][2]. You can get a DOI for the data you downloaded by creating a "derived" dataset. For this to work, you need to keep the "datasetKey" variable in your dataset.
https://www.gbif.org/occurrence https://www.gbif.org/derived-dataset/about
sp_occurrence("solanum", download=FALSE) sp_occurrence("solanum", "acaule", download=FALSE) sp_occurrence("Batrachoseps", "" , down=FALSE) sp_occurrence("Batrachoseps", "luciae", down=FALSE) g <- sp_occurrence("Batrachoseps", "luciae", geo=TRUE, end=25) #plot(g[, c("lon", "lat")]) ## args a1 <- sp_occurrence("Elgaria", "multicarinata", args="recordNumber=Robert J. Hijmans RH-2") a2 <- sp_occurrence("Batrachoseps", "luciae", args=c("year=2023", "identifiedBy=Anthony Ye")) ## year supports "range queries" a3 <- sp_occurrence("Batrachoseps", "luciae", args=c("year=2020,2023", "identifiedBy=Kuoni W")) #table(a3[,c("year")])
sp_occurrence("solanum", download=FALSE) sp_occurrence("solanum", "acaule", download=FALSE) sp_occurrence("Batrachoseps", "" , down=FALSE) sp_occurrence("Batrachoseps", "luciae", down=FALSE) g <- sp_occurrence("Batrachoseps", "luciae", geo=TRUE, end=25) #plot(g[, c("lon", "lat")]) ## args a1 <- sp_occurrence("Elgaria", "multicarinata", args="recordNumber=Robert J. Hijmans RH-2") a2 <- sp_occurrence("Batrachoseps", "luciae", args=c("year=2023", "identifiedBy=Anthony Ye")) ## year supports "range queries" a3 <- sp_occurrence("Batrachoseps", "luciae", args=c("year=2020,2023", "identifiedBy=Kuoni W")) #table(a3[,c("year")])
Download global travel time to a city or port data on rasters at a 30 arc-seconds (about 1 km2) resolution.
travel_time(to="city", size=1, up=FALSE, path, ...)
travel_time(to="city", size=1, up=FALSE, path, ...)
to |
character. "city" or "port" |
size |
positive integer indicating the size of the city or port. Can be between 1 and 9 if |
up |
logical. If |
path |
character. Path for storing the downloaded data. See |
... |
additional arguments passed to |
Description of the the size
argument.
to="city"
size | Inhabitants | |
1 | 5,000,000 to 50,000,000 | |
2 | 1,000,000 to 5,000,000 | |
3 | 500,000 to 1,000,000 | |
4 | 200,000 to 500,000 | |
5 | 100,000 to 200,000 | |
6 | 50,000 to 100,000 | |
7 | 20,000 to 50,000 | |
8 | 10,000 to 20,000 | |
9 | 5,000 to 10,000 | |
to="port"
size | Description | Number of ports | |
1 | Large | 160 | |
2 | Medium | 361 | |
3 | Small | 990 | |
4 | Very small | 2,153 | |
5 | Any | 3,778 | |
SpatRaster
Nelson, A., D.J. Weiss, J. van Etten, A. Cattaneo, T.S. McMenomy & J. Koo, 2019. A suite of global accessibility indicators. Scientific Data 6: 266. doi:10.1038/s41597-019-0265-5
Version 3 (2019-05-15) from https://figshare.com/articles/dataset/Travel_time_to_cities_and_ports_in_the_year_2015/7638134/3
Get the borders for all the countries in the world. Data are read from files that are downloaded if necessary.
world(resolution=5, level=0, path, version="latest", ...)
world(resolution=5, level=0, path, version="latest", ...)
resolution |
integer between 1 and 5 indicating the level of detail. 1 is high 5 is low |
level |
numeric. The level of administrative subdivision requested. (starting with 0 for country, then 1 for the first level of subdivision). Only level 0 is currently available |
path |
character. Path for storing the downloaded data. See |
version |
character. Only "3.6" is currently supported |
... |
additional arguments passed to |
The data are from https://gadm.org
SpatVector
w <- world(path=tempdir())
w <- world(path=tempdir())
Download climate data from WorldClim version 2.1. See Details for variables and units.
worldclim_global(var, res, path, version="2.1", ...) worldclim_country(country, var, path, version="2.1", ...) worldclim_tile(var, lon, lat, path, version="2.1", ...)
worldclim_global(var, res, path, version="2.1", ...) worldclim_country(country, var, path, version="2.1", ...) worldclim_tile(var, lon, lat, path, version="2.1", ...)
var |
character. Valid variables names are "tmin", "tmax", "tavg", "prec", "wind", "vapr", and "bio" |
res |
numeric. Valid resolutions are 10, 5, 2.5, and 0.5 (minutes of a degree) |
path |
character. Path for storing the downloaded data. See |
country |
character. Country name or code |
lon |
numeric. Longitude |
lat |
numeric. Latitude |
version |
character or numeric. WorldClim version number. Only "2.1" supported at the moment |
... |
additional arguments passed to |
These are the WorldClim monthly average climate data.
Variable | Description | Unit | |
tmin |
minimum temperature | °C | |
tmax |
maximum temperature | °C | |
tavg |
average temperature | °C | |
prec |
total precipitation | mm | |
srad |
incident solar radiation | kJ m-2 day-1 | |
wind |
wind speed (2 m above the ground) | m s-1 | |
vapr |
vapor pressure | kPa | |
SpatRaster
lux <- worldclim_country("Luxembourg", var="tmin", path=tempdir())
lux <- worldclim_country("Luxembourg", var="tmin", path=tempdir())