It shows how raster values can be ‘masked’ and ‘extracted’ by vector geometries. The final Section 5.4 connects vector and raster objects. These operations are especially useful if one would like to align raster datasets from diverse sources.Īligned raster objects share a one-to-one correspondence between pixels, allowing them to be processed using map algebra operations, described in Section 4.3.2.
It teaches how to change the resolution (also called raster aggregation and disaggregation), the extent and the origin of a raster.
This involves changing the size and number of the underlying pixels, and assigning them new values. Section 5.3 covers geometric transformations on raster objects. Type transformations (from a polygon to a line, for example) are demonstrated in Section 5.2.7. This includes clipping and geometry unions, covered in Sections 5.2.5 and 5.2.6, respectively. This includes simplification (of lines and polygons), the creation of buffers and centroids, and shifting/scaling/rotating single geometries using ‘affine transformations’ (Sections 5.2.1 to 5.2.4).īinary transformations modify one geometry based on the shape of another. Unary operations work on a single geometry in isolation. Section 5.2 covers transforming vector geometries with ‘unary’ and ‘binary’ operations.
The previous three chapters have demonstrated how geographic datasets are structured in R (Chapter 2) and how to manipulate them based on their non-geographic attributes (Chapter 3) and spatial properties (Chapter 4).Īfter reading it - and attempting the exercises at the end - you should understand and have control over the geometry column in sf objects and the geographic location of pixels represented in rasters.