Geometry & topology

Clipping, buffering, dissolving and overlays — and what makes a geometry valid.

A self-intersecting polygon repaired by make_valid, which returns two polygons rather than one. valid is not the same as unchangedPolygonmake_valid()MultiPolygonEvery overlay assumes validity; the repair that grants it can change the geometry type on the way

This is the topic where the shapes themselves live: clipping, buffering, dissolving, overlaying, simplifying, and the question that sits under all of them — whether a geometry is valid.

Validity is not a formality. A self-intersecting polygon has no well-defined inside, so every operation that depends on inside and outside is free to return anything. GEOS will often give you an answer rather than an error, which is why an overlay can produce a plausible-looking layer with the wrong area in it. Repair is cheap; noticing that you needed it is the hard part, and make_valid can hand back a different geometry type while it is at it.

Work down the page: the concepts settle what the operations actually compute and what valid means, the how-to guides are the operations themselves, and the fixes are what the operations do when a geometry, a precision or a CRS was not what the function assumed.

Learning paths run through this topic too — see the end of this page.

🧭 Start with the concepts

The ideas the how-to guides below assume you already have.

Show every concept in this topic

⚙️ Then do the task

Step-by-step walkthroughs with code you can copy and adapt.

Show every how-to guide in this topic

🔧 When it breaks

The errors this topic produces, with the cause explained rather than just the command.

Show every fix in this topic

Related topics

Subjects that keep coming up alongside this one, most overlap first.

Keep browsing

Geometry & topology sits in Geometry & space. Every topic on the site is listed on the topics index.