In this chapter, we'll look at various ways of combining spatial data. This could be, for example, collating a column of Points together into a single MultiPoint geometry (using
UnionAggregate()) or joining two touching LineStrings together into a single LineString (using
STUnion()). Combinations do not have to be additive; you can also, for example, subtract the area of space occupied by one Polygon from another, using
STDifference(), or obtain the unique parts of two geometries using
STSymDifference(). The common feature of all the methods discussed in this chapter is that they take two or more inputs and combine them in some way to produce a single output.