Punching holes in polygons with a symmetric difference operation

Why, oh why would we want to punch holes in polygons and create a donut? Well, this is done for several reasons, for example, you may want to remove a lake polygon from a forest polygon that it overlaps since it sits in the middle of the forest and is, therefore, included in your area calculations.

Another example is where we have a set of polygons representing a golf course's fairways and a second set of polygons representing the greens that overlap these fairways. Our task is to calculate the correct number of square meters of fairways. The greens will create our donuts in a fairway's polygons.

This is translated into spatial operation terminology and means that we need to perform ...

Get Python Geospatial Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.