ABSTRACT

Spatial data can be represented using vector and raster data. Vector data is used to display points, lines, and polygons, and possibly associated information. Vector data may represent, for example, locations of monitoring stations, road networks, or municipalities of a country. Raster data are regular grids with cells of equal size that are used to store values of spatially continuous phenomena, such as elevation, temperature, or air pollution values. The sf and terra packages are the main packages that allow people to manipulate and analyze spatial data in R. In this chapter, the authors introduce these packages, spatial data storage files, and coordinate reference systems. They give an overview of old spatial packages that were widely used but are not longer maintained. Vector data are often represented using a data storage format called shapefile. Note that a shapefile is not a single file but a collection of related files.