11 Geometry and geography processing

 

This chapter covers

  • Spatial aggregation
  • Clipping, splitting, tessellating, segmentizing, and subdividing
  • Translating, scaling, and rotating geometries (affine operations)
  • Using geometry functions with geography types

This chapter demonstrates techniques for manipulating geometries and geographies, and the end result is generally another geometry or geography. Unless we tell you otherwise, all functions that we demonstrate in this chapter work with both data types.

Through the years, we’ve amassed a catalog of problems that GIS users encounter, and in this chapter we’ll share with you the most common problems we’ve witnessed and our solutions. Keep in mind that multiple solutions exist for a given problem. We by no means proclaim that our solutions trump all other solutions. In fact, if enough people run into a problem that can be generalized, PostGIS could very well introduce a wrapper function that will resolve the problem with a single call.

The data and code used in this chapter are located here: www.postgis.us/chapter_ 11_edition_3.

11.1 Using spatial aggregate functions

11.1.1 Creating a multipolygon from many multipolygon records

11.1.2 Creating linestrings from points

11.2 Clipping, splitting, tessellating

11.2.1 Clipping

11.2.2 Splitting

11.2.3 Tessellating

11.3 Breaking linestrings into smaller segments

11.3.1 Segmentizing linestrings

11.3.2 Creating two-point linestrings from many-point linestrings

11.3.3 Breaking linestrings at point junctions

11.4 Translating, scaling, and rotating geometries

11.4.1 Translating

11.4.2 Scaling