Creating rasters from vector layers
One of the main reasons to convert a vector layer to a raster is that we are interested in employing raster analysis tools or procedures on data that is currently held in vector form (and vice versa). For example, when preparing a multiband raster with various environmental characteristics of a given area, such as slope or NDVI, we may wish to add layers that are commonly given in the vector format, such as built area polygons or road lines. To do this, we first need to convert these vector layers to rasters, and then supplement the multiband raster with the additional layers.
The process of converting a vector layer to a raster is called rasterizing, in the raster
package terminology, and it is performed with the rasterize
function. In this section, we will see an example of how to rasterize a point vector layer, while keeping in mind that the procedures to rasterize lines and polygons are analogous. You will also learn the related operations of raster...