ABSTRACT

Spatial data are used in a wide range of disciplines including environment, health, agriculture, economy, and society. Several R packages have been recently developed as clients for various databases that can be used for easy access of spatial data including administrative boundaries, climatic, and OpenStreetMap data. This chapter provides short reproducible examples on how to download and visualize spatial data that can be useful in different settings. The geodata package allows people to download geographic data including climate, elevation, land use, soil, crop, species occurrence, administrative boundaries, and other data. The geodata package is a successor of the getData() function from the raster package. The chirps package allows people to obtain daily high-resolution precipitation, as well as daily maximum and minimum temperatures from the Climate Hazards Group. The elevatr package allows people to get elevation data from Amazon Web Services Terrain Tiles and OpenTopography Global Digital Elevation Models API.