4.1 Introduction

Spatial operations are a vital part of geocomputation.This chapter shows how spatial objects can be modified in a multitude of ways based on their location and shape.The content builds on the previous chapter because many spatial operations have a non-spatial (attribute) equivalent.This is especially true for vector operations: Section 3.2 on vector attribute manipulation provides the basis for understanding its spatial counterpart, namely spatial subsetting (covered in Section 4.2.1).Spatial joining (Section 4.2.3) and aggregation (Section 4.2.5) also have non-spatial counterparts, covered in the previous chapter.

Spatial operations differ from non-spatial operations in some ways, however.To illustrate the point, imagine you are researching road safety.Spatial joins can be used to find road speed limits related with administrative zones, even when no zone ID is provided.But this raises the question: should the road completely fall inside a zone for its values to be joined?Or is simply crossing or being within a certain distance sufficient?When posing such questions, it becomes apparent that spatial operations differ substantially from attribute operations on data frames:the type of spatial relationship between objects must be considered.These are covered in Section 4.2.2, on topological relations.

Another unique aspect of spatial objects is distance.All spatial objects are related through space and distance calculations, covered in Section 4.2.6, can be used to explore the strength of this relationship.

Spatial operations also apply to raster objects.Spatial subsetting of raster objects is covered in Section 4.3.1; merging several raster ‘tiles’ into a single object is covered in Section 4.3.7.For many applications, the most important spatial operation on raster objects is map algebra, as we will see in Sections 4.3.2 to 4.3.6.Map algebra is also the prerequisite for distance calculations on rasters, a technique which is covered in Section 4.3.6.

It is important to note that spatial operations that use two spatial objects rely on both objects having the same coordinate reference system, a topic that was introduced in Section 2.4 and which will be covered in more depth in Chapter 6.