Geometry & topology
Clipping, buffering, dissolving and overlays — and what makes a geometry valid.
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.
🧭 Start with the concepts
The ideas the how-to guides below assume you already have.
- Overlay Operations in GeoPandas: Union, Intersection, Difference Explained
- Shapely Basics: Working with Geometry Objects in Python
- What Makes a Geometry Valid? The OGC Rules Explained
- WKT, WKB and GeoJSON: How Geometry Is Actually Stored
- Coordinate Precision and Floating Point in GIS Explained
- Spatial Predicates Explained: Intersects, Within, Contains and the Rest
Show every concept in this topic
- Null, Empty, Missing and Invalid: Four Kinds of Broken Geometry
- Topological Coverage: What "Clean" Means for Adjacent Polygons
- Why GeoPandas Is Slow: The Four Real Bottlenecks
- Projected vs Geographic CRS: What Actually Changes When You Reproject
- Street Networks as Graphs Explained
- Generalisation for Zoom Levels Explained
- Map Scale Explained: How Much Detail a Scale Can Hold
- H3 Hierarchy Explained: Parents, Children and Why They Do Not Nest Exactly
- Catchment Areas Explained: Buffers, Isochrones and Voronoi Compared
- Geomasking methods explained: donut, random and adaptive
- 3D spatial data models explained: 2.5D, meshes and solids
- The coastline paradox explained for GIS work
- Maritime boundaries explained: EEZ, territorial sea and baselines
- M Values Explained: Geometry That Carries a Measure
- Route Calibration Explained: Why Measures Are Not Lengths
- Morphological Tessellation Explained
⚙️ Then do the task
Step-by-step walkthroughs with code you can copy and adapt.
- How to Filter Spatial Data in Python Using GeoPandas
- How to Clip Spatial Data in Python with GeoPandas
- How to Dissolve Polygons in Python (GeoPandas)
- How to Calculate Area and Distance in GeoPandas (Correctly)
- How to Create Buffers in GeoPandas for Spatial Analysis
- How to Get Polygon Centroids in GeoPandas
Show every how-to guide in this topic
- How to Count Points in Polygons with GeoPandas
- How to Simplify Geometry in Python with GeoPandas and Shapely
- How to Create a Fishnet Grid in Python with GeoPandas
- How to Convert a Raster to a Vector in Python
- How to Convert Points to Lines in GeoPandas
- How to Aggregate Spatial Data by Region in GeoPandas
- How to Remove Null and Empty Geometries in GeoPandas
- How to Find and Remove Duplicate Geometries in GeoPandas
- How to Snap and Align Geometries to Fix Slivers and Gaps in Python
- How to Batch Clip Many Layers to a Single Boundary in Python
- How to Split Multipart Geometries into Single Parts in GeoPandas
- How to Find and Fix Gaps and Overlaps in a Polygon Coverage
- How to Clean a Line Network: Dangles, Overshoots and Disconnects
- How to Clip a Raster to a Polygon in Python
- How to Rasterize a Vector Layer in Python
- How to Add Legends, Labels and a Scale Bar to a GeoPandas Map
- How to Plot Multiple Layers on One Map in GeoPandas
- How to Assert on Geometry in pytest Without Flaky Comparisons
- How to Replace a Row Loop with Vectorised GeoPandas Operations
- How to Choose the Right Projected CRS for Your Study Area
- How to Measure Distance Accurately in Python: Geodesic vs Projected
- How to Calculate the Shortest Path Along a Street Network
- How to Clip a NetCDF Grid to a Polygon in Python
- How to Fill a Polygon with H3 Cells
- How to Turn H3 Cells into a GeoDataFrame of Polygons
- How to Calculate Population-Weighted Centroids
- How to Build Voronoi Service Areas Around Facilities in Python
- How to Extract a Stream Network from a DEM
- How to apply donut geomasking to sensitive points in Python
- How to extrude building footprints into 3D in Python
- How to calculate building volumes and floor area in Python
- How to clip a dataset to an exclusive economic zone
- How to extract the part of a route between two measures
- How to draw a species range from occurrence points
- How to Calculate Building Shape Metrics in Python
- How to Create a Morphological Tessellation in Python
- How to Find Where a Wildfire Reburned Earlier Fires in Python
- How to Calculate the Distance Between Two Coordinates in Python (Haversine)
- How to Calculate the Bearing Between Two Coordinates in Python
- How to Find a Destination Point from Distance and Bearing in Python
🔧 When it breaks
The errors this topic produces, with the cause explained rather than just the command.
- How to Fix Invalid Geometries in Python (GeoPandas)
- Shapely TopologyException: Found Non-Noded Intersection (How to Fix)
- GeoPandas "No Geometry Column" Error: How to Fix It
- buffer(0) Does Not Fix My Invalid Geometry: What to Do Instead
- Mixed Geometry Types Error When Saving a GeoDataFrame: How to Fix It
- My Cleaned Layer Has More Rows Than the Original: How to Fix It
Show every fix in this topic
- GeoPandas .apply() Takes Hours: How to Fix It
- Contours Come Out Jagged or Full of Tiny Rings
- NetworkX Says No Path Exists Between Two Nodes
- Fixing H3 Polygon Fill That Misses Cells or Returns Nothing
- Fixing Voronoi Polygons That Extend Forever or Miss the Study Area
- Geomasked points land in the sea or outside the study area
- A building mesh is not watertight and its volume is wrong
- Delineated field boundaries merge fields or swallow roads
- Route measures are not monotonic
- A range polygon has the wrong shape
- Tessellation Fails or Produces Odd Cells
- Why Are My Fire Perimeter Areas Wrong or Raising TopologyException?
- Fixing Buffers Drawn in Degrees Instead of Kilometres
- Fixing OpenStreetMap Lakes and Parks That Show as Lines Instead of Polygons
Learning paths through this topic
A curated route rather than a list — the guides in the order that builds on itself.
- Terrain & Elevation
- Networks & Routing
- Raster Analysis
- Making Maps
- GIS Data Cleaning
- Batch Processing
- Publishing Web Maps
- Cartography & Map Design
- Gridded & Climate Data
- H3 & Global Grids
- Census & Demographics
- Location & Accessibility
- Hydrology & Watersheds
- Geoprivacy & Anonymisation
- 3D & Buildings
- Coastal & Marine
- Agriculture & Crops
- Biodiversity & Species Data
- Linear Referencing
- Urban Morphology
Related topics
Subjects that keep coming up alongside this one, most overlap first.