Geodata

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

Package ‘geodata’

December 1, 2022
Type Package
Title Download Geographic Data
Version 0.5-3
Date 2022-11-30
Depends R (>= 3.5.0), terra
Encoding UTF-8
Suggests jsonlite, R.utils
Author Robert J. Hijmans [cre, aut], Aniruddha Ghosh [ctb], Alex Mandel [ctb]
Maintainer Robert J. Hijmans <[email protected]>
Description Functions for downloading of geographic data for use in spatial analysis and map-
ping. The package facilitates access to climate, elevation, land use, soil, species occurrence, ac-
cessibility, administrative boundaries and other data.
License GPL (>= 3)
BugReports https://github.com/rspatial/geodata/issues/
NeedsCompilation no
Repository CRAN
Date/Publication 2022-12-01 16:00:06 UTC

R topics documented:
geodata-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
cmip6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
country_codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
cropland . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
crop_calendar_sacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
crop_monfreda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
crop_spam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
elevation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
gadm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
landcover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

1
2 geodata-package

osm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
population . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
soil_af . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
soil_af_elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
soil_af_isda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
soil_world . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
soil_world_vsi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
sp_occurrence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
travel_time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
world . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
worldclim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Index 28

geodata-package Download Geographic Data

Description
Functions for downloading of geographic data for use in spatial analysis and mapping. The package
facilitates access to climate, elevation, land use, soil, species occurrence, accessibility, administra-
tive boundaries and other data.

Function Description
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_elements Soil element concentration data for Africa
soil_af_isda Soil data for Africa derived from the iDSA data set
soil_af Chemical soil properties data for Africa for different soil depths
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
cmip6 3

worldclim_country Climate data by country


worldclim_tile Climate data by tile

cmip6 CMIP6 climate model data

Description
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/

Usage
cmip6_world(model, ssp, time, var, res, path, ...)

cmip6_tile(lon, lat, model, ssp, time, var, path, ...)

Arguments
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 where to download the data to
... additional arguments passed to download.file
lon numeric. Longitude
lat numeric. Latitude

Value
SpatRaster

See Also
vrt to combine tiles
4 cropland

Examples

bio10 <- cmip6_world("CNRM-CM6-1", "585", "2061-2080", var="bioc", res=10, path=tempdir())

country_codes Get country codes

Description
Get country codes for all countries in the world.

Usage
country_codes()

Value
data.frame

Examples
cc <- country_codes()
head(cc)

cropland Cropland distribution data

Description
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 avail-
able 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/

Usage
cropland(source, path, year, ...)
crop_calendar_sacks 5

Arguments
source character. One of "WorldCover", "GLAD", or "QED"
path character. Path name where the data should be downloaded to
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 download.file

Value
SpatRaster

References
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

See Also
landcover

Examples

#x <- cropland("WorldCover", path=tempdir())

crop_calendar_sacks Sacks crop calendar data

Description
Download Sacks crop calendar data. The crops available are returned by sacksCrops

Usage
crop_calendar_sacks(crop="", path, ...)

sacksCrops()
6 crop_monfreda

Arguments

crop character. Crop name. See sacksCrops for valid names


path character. Path name where the data should be downloaded to
... additional arguments passed to download.file

Value

SpatRaster

References

Sacks, W.J., D. Deryng, J.A. Foley, and N. Ramankutty, 2010. Crop planting dates: an anal-
ysis of global patterns. Global Ecology and Biogeography 19: 607-620. doi:10.1111/j.1466-
8238.2010.00551.x.

See Also

https://sage.nelson.wisc.edu/data-and-models/datasets/crop-calendar-dataset/

Examples

cas <- crop_calendar_sacks("cassava", path=tempdir())

crop_monfreda Monfreda crop data

Description

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.

Usage

monfredaCrops()
crop_monfreda(crop="", var="area_ha", path, ...)
crop_spam 7

Arguments

crop character. Crop name(s). See monfredaCrops for valid names


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 name where the data should be downloaded to
... additional arguments passed to download.file

Value

SpatRaster

References

Monfreda, C., N. Ramankutty, and J. A. Foley (2008), Farming the planet: 2. Geographic distribu-
tion of crop areas, yields, physiological types, and net primary production in the year 2000, Global
Biogeochem. Cycles, 22, GB1022, doi:10.1029/2007GB002947.

See Also

http://www.earthstat.org/harvested-area-yield-175-crops/

Examples

mcas <- crop_monfreda("cassava", path=tempdir())


mcas
names(mcas)

crop_spam SPAM crop data

Description

SPAM crop data

Usage

spamCrops()
crop_spam(crop="", var="area", path=".", africa=FALSE, ...)
8 elevation

Arguments
crop character. See spamCrops for valid names
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 name where the data should be downloaded to
africa logical. retrieve the (updated) data for Africa instead of global data
... additional arguments passed to download.file

Value
SpatRaster

References
International Food Policy Research Institute, 2020. Spatially-Disaggregated Crop Production Statis-
tics Data in Africa South of the Sahara for 2017. https://doi.org/10.7910/DVN/FSSKBW, Harvard
Dataverse, V2

See Also
https://www.mapspam.info/data/

Examples

cas <- crop_spam("cassava", "area", path=tempdir(), TRUE)

elevation Elevation

Description
Get elevation data for any country in the world. 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).

Usage
elevation_3s(lon, lat, path, ...)
elevation_30s(country, path, mask=TRUE, subs="", ...)
elevation_global(res, path, ...)
footprint 9

Arguments
lon numeric. Longitude
lat numeric. Latitude
path character. Path where to download the data to
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 download.file

Value
SpatRaster

Examples
## Not run:
elevation_30s(country="FRA", path=tempdir() )

## End(Not run)

footprint Human footprint

Description
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 wa-
terways. It is expressed on a scale of 0 (low) to 50 (high footprint). See https://www.nature.com/articles/sdata201667
for the details. And the original data is 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 longi-
tude/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.

Usage
footprint(year=2009, path, ...)
10 gadm

Arguments
year character. "1993" or "2009"
path character. Path name where the data should be downloaded to
... additional arguments passed to download.file

Value
SpatRaster

References
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.

See Also
landcover

gadm Administrative boundaries

Description
Get administrative boundaries for any country in the world. Data are read from files that are down-
loaded if necessary.

Usage
gadm(country, level=1, path, version="latest", resolution=1, ...)

Arguments
country character. Three-letter ISO code or full country name. If you provide multiple
names they are all downloaded and rbind-ed together
level numeric. The level of administrative subdivision requested. (starting with 0 for
country, then 1 for the first level of subdivision)
path character. Path name indicating where to store the data
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 download.file
landcover 11

Details
The data are from https://gadm.org

Value
SpatVector

See Also
world

Examples

fra <- gadm(country="FRA", level=1, path=tempdir())

landcover Landcover data

Description
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.

Usage
landcover(var, path, ...)

Arguments
var character. One of "trees", "grassland", "shrubs", "cropland", "built", "bare",
"snow", "water", "wetland", "mangroves", "moss"
path character. Path name where the data should be downloaded to
... additional arguments passed to download.file

Value
SpatRaster

References
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.
12 osm

See Also

landcover

osm OpenStreetMap data

Description

Get OpenStreetMap (OSM) data

Usage

osm(country, var, path, proxy=FALSE, ...)

Arguments

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 name indicating where to store the data
proxy logical. Return a SpatVectorProxy?
... additional arguments passed to download.file

Details

tbd
License: Open Data Commons Open Database License (ODbL). See https://www.openstreetmap.
org/copyright

Value

SpatVector

Examples

aruba <- osm(country="Aruba", "places", path=tempdir())


population 13

population population density

Description

Download population density data.


Source: Gridded Population of the World (GPW), v4 Documentation: http://sedac.ciesin.columbia.edu/data/collection/gpw-
v4/documentation

Usage

population(year, res, path, ...)

Arguments

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 where to download the data to
... additional arguments passed to download.file

Value

SpatRaster

References

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. Ac-
cessed 6 July 2021.

Examples

pop <- population(2020, 10, path=tempdir())


14 soil_af

soil_af Soil data for Africa

Description
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

Usage
soil_af(var, depth, path, ...)

Arguments
var character. Variables name such as "pH" or "clay". 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. Or one of 20, 50
for 0-20 or 20-50 cm
path character. Path to download the data to
... additional arguments passed to download.file

Details

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 (volum. frac.) for FC = pF 2.0 -
AWpF2.3 Avail. soil water capacity (volum. frac.) for FC = pF 2.3 -
AWpF2.5 Avail. soil water capacity (volum. fract.) for FC = pF 2.4 -
AWpF4.2 Avail. soil water capacity (volum. fract.) at wilting point (pF 4.2) -
BDR Depth to bedrock cm
. . .
pH pH (H2 O) -
ECN Electrical conductivity mS/m (?)
acid-exch Exchangeable acidity cmol(+) · kg −1
bases-exch Sum of exchangeable bases cmol(+) · kg −1
soil_af_elements 15

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

Value
SpatRaster

References
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

See Also
soil_af_elements, soil_af_isda, soil_world_vsi

Examples

aph <- soil_af(var="ph", depth=5, path=tempdir())

soil_af_elements Soil elements data for Africa

Description
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

Usage
soil_af_elements(var, path, ...)
16 soil_af_elements

Arguments
var character. Variables name. One of: "Al", "B", "Ca", "Cu", "Fe", "K", "Mg",
"Mn", "N", "Na", "P", "Ptot", "Zn". See Details
path character. Path to download the data to
... additional arguments passed to download.file

Details

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)

Value
SpatRaster

References
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

See Also
soil_af, soil_af_isda, soil_world

Examples

fe <- soil_af_elements("Fe", path=tempdir(), quiet=TRUE)


soil_af_isda 17

soil_af_isda iSDA soil data for Africa

Description
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

Usage
soil_af_isda(var, depth=20, error=FALSE, path, ...)

Arguments
var character. The variables name, one of: "Al", "bdr", "clay", "C.tot", "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 var="bdr"
for which the depth is always 0-200 cm
error logical. If TRUE the error estimates are returned
path character. Path name where the data should be downloaded to
... additional arguments passed to download.file

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 · m3
eCEC.f effective cation exchange capacity cmol(+)k̇g −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 (H2 O) -
sand Sand content %
18 soil_world

silt Silt content %


S Extractable sulfer mg · kg −1
texture texture class -
wpg2 stone content %
Zn Extractable zinc mg · kg −1

Value
SpatRaster

References
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 prop-
erties and nutrients mapped at 30 m spatial resolution using two-scale ensemble machine learning.
Scientific Reports 11: 6130.

See Also
soil_af_elements, soil_af, soil_world

Examples

afph <- soil_af_isda("ph.h2o", path=tempdir(), quiet=TRUE)

soil_world Global soil data

Description
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

Usage
soil_world(var, depth, stat="mean", name="", path, ...)
soil_world 19

Arguments
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 follow-
ing depth ranges: 0-5, 5-15, 15-30, 30-60, 60-100, 100-200 cm. Ignored if
var="wrb"
stat character. One of "mean", "uncertainty", "Q0.05", "Q0.5", "Q0.95". Ignored if
var="wrb"
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", "Pod-
zols", "Regosols", "Solonchaks", "Solonetz", "Stagnosols", "Umbrisols", "Ver-
tisols". Only used when var="wrb"
path character. Path name where the data should be downloaded to
... additional arguments passed to download.file

Details

var description unit


bdod Bulk density of the fine earth fraction kg · dm−3
cec Cation Exchange Capacity of the soil cmol(+)k̇g −1
cfvo Vol. fraction of coarse fragments (> 2 mm) %
nitrogen Total nitrogen (N) g · kg −1
phh2o pH (H2 O) -
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

Value

SpatRaster

References

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
20 soil_world_vsi

See Also
For virtual access to the original data: soil_world_vsi For Africa: soil_af_isda, soil_af,
soil_af_elements

Examples

gph <- soil_world(var="phh2o", depth=5, path=tempdir())

soil_world_vsi soil grids_vsi

Description
Virtually connect to the global soilgrids data. See https://www.isric.org/explore/soilgrids for more
info.
data license: CC-BY 4.0

Usage
soil_world_vsi(var, depth, stat="mean", name="")

Arguments
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 follow-
ing depth ranges: 0-5, 5-15, 15-30, 30-60, 60-100, 100-200 cm. Ignored if
var="wrb"
stat character. One of "mean", "uncertainty", "Q0.05", "Q0.5", "Q0.95". Ignored if
var="wrb"
name character. One of ’Acrisols’, ’Albeluvisols’, ’Alisols’, ’Andosols’, ’Arenosols’,
’Calcisols’, ’Cambisols’, ’Chernozems’, ’Cryosols’, ’Durisols’, ’Ferralsols’, ’Flu-
visols’, ’Gleysols’, ’Gypsisols’, ’Histosols’, ’Kastanozems’, ’Leptosols’, ’Lix-
isols’, ’Luvisols’, ’Nitisols’, ’Phaeozems’, ’Planosols’, ’Plinthosols’, ’Podzols’,
’Regosols’, ’Solonchaks’, ’Solonetz’, ’Stagnosols’, ’Umbrisols’, ’Vertisols’. Only
used when var="wrb"

Details
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


sp_occurrence 21

bdod Bulk density of the fine earth fraction cg · cm−3


cec Cation Exchange Capacity of the soil mmol(+)k̇g −1
cfvo Vol. fraction of coarse fragments (> 2 mm) %
nitrogen Total nitrogen (N) cg · kg −1
phh2o pH (H2 O) -
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

Value
SpatRaster

References
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

See Also
soil_world to download these data at 30-seconds spatial resolution.
For Africa: soil_af_isda, soil_af, soil_af_elements

Examples

ph <- soil_world_vsi(var="phh2o", depth=5)


plot(ph, maxcell=10000)

sp_occurrence Download species occurrence data from GBIF

Description
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.
22 sp_occurrence

To avoid getting more than 100,000 records, you can do separate queries for different geographic
areas. 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.

Usage
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, ...)

Arguments
genus character. genus name
species character. species name. Use ’*’ to download the entire genus. Append ’*’ to
the species name to get all naming variants (e.g. with and witout species author
name) and sub-taxa
ext Extent object to limit the geographic extent of the records. An extent can be
created using functions like ext and draw
args character. Additional arguments to refine the query. See query parameters in
http://www.gbif.org/developer/occurrence for more details
geo logical. If TRUE, only records that have a georeference (longitude and latitude
values) will be downloaded
removeZeros logical. If TRUE, all records that have a latitude OR longitude of zero will be
removed if geo==TRUE, or set to NA if geo==FALSE. If FALSE, only records that
have a latitude AND longitude that are zero will be removed or set to NA
download logical. If TRUE, records will be downloaded, else only the number of records
will be shown
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 TRUE a few unwieldy and poorly chosen variable names are changed as fol-
lows. "decimalLatitude" to "lat", "decimalLongitude" to "lon", "stateProvince"
to "adm1", "county" to "adm2", "countryCode" to "ISO2". The names in "coun-
try" are replaced with the common (short form) country name, the original val-
ues are stored as "fullCountry"
simple logical. If TRUE, a vector the accepted species names are returned. Otherwise a
data.frame with much more information is returned
... additional arguments passed to download.file
travel_time 23

Value
data frame

Note
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.

References
https://www.gbif.org/occurrence https://www.gbif.org/derived-dataset/about

Examples
## Not run:

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)
plot(g$lon, g$lat)

gs <- sp_occurrence("Batrachoseps", "luciae")


plot(gs)

## End(Not run)

travel_time Travel time to a city or port

Description
Download travel time to a city or port data on rasters at a 30 arc-seconds (about 1 km2) resolution.

Usage
travel_time(to="city", size=1, up=FALSE, path, ...)

Arguments
to character. "city" or "port"
size positive integer indicating the size of the city or port. Can be between 1 and 9 if
to="city" or between 1 and 5 if to="port". See Details
up logical. If TRUE the travel time to a city of the size chosen or larger is returned
24 travel_time

path character. Path name where the data should be downloaded to


... additional arguments passed to download.file

Details
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

Value
SpatRaster

References
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

Examples

ttime <- travel_time("city", 2, path=tempdir(), quiet=TRUE)


world 25

world Administrative boundaries

Description

Get the borders for all the countries in the world. Data are read from files that are downloaded if
necessary.

Usage

world(resolution=5, level=0, path, version="latest", ...)

Arguments

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 name indicating where to store the data
version character. Only "3.6" is currently supported
... additional arguments passed to download.file

Details

The data are from https://gadm.org

Value

SpatVector

See Also

gadm

Examples

w <- world(path=tempdir())
26 worldclim

worldclim WorldClim climate data

Description
Download climate data from WorldClim version 2.1. See Details for variables and units.

Usage
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", ...)

Arguments
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 where to download the data to
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 download.file

Details
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

Value

SpatRaster
worldclim 27

See Also
https://www.worldclim.org/

Examples

lux <- worldclim_country("Luxembourg", var="tmin", path=tempdir())


Index

∗ spatial soil_af, 2, 14, 16, 18, 20, 21


sp_occurrence, 21 soil_af_elements, 2, 15, 15, 18, 20, 21
soil_af_isda, 2, 14–16, 17, 20, 21
cmip6, 3 soil_world, 2, 14, 16, 18, 18, 21
cmip6_tile, 2 soil_world_vsi, 2, 15, 20, 20
cmip6_tile (cmip6), 3 sp_genus (sp_occurrence), 21
cmip6_world, 2 sp_occurrence, 2, 21
cmip6_world (cmip6), 3 spamCrops (crop_spam), 7
country_codes, 2, 4
crop_calendar_sacks, 2, 5 travel_time, 2, 23
crop_monfreda, 2, 6
crop_spam, 2, 7 vrt, 3
cropland, 2, 4
world, 2, 11, 25
download.file, 3, 5–14, 16, 17, 19, 22, 24–26 worldclim, 26
draw, 22 worldclim_country, 3
worldclim_country (worldclim), 26
elevation, 8 worldclim_global, 2
elevation_30s, 2 worldclim_global (worldclim), 26
elevation_30s (elevation), 8 worldclim_tile, 3
elevation_3s, 2 worldclim_tile (worldclim), 26
elevation_3s (elevation), 8
elevation_global, 2
elevation_global (elevation), 8
ext, 22

footprint, 2, 9

gadm, 2, 10, 25
geodata (geodata-package), 2
geodata-package, 2

landcover, 2, 5, 10, 11, 12

monfredaCrops (crop_monfreda), 6

osm, 2, 12

population, 2, 13

sacksCrops (crop_calendar_sacks), 5

28

You might also like