Shapely TopologyException: Found Non-Noded Intersection (How to Fix)

On this page

Problem statement

An overlay that dies partway through with TopologyException has hit geometry GEOS cannot node — usually invalid polygons or coordinates snapped too coarsely. The messages come in a few forms:

shapely.errors.GEOSException: TopologyException: found non-noded intersection between LINESTRING ... at ...
shapely.errors.GEOSException: TopologyException: side location conflict at ...
shapely.errors.GEOSException: TopologyException: unable to assign free hole to a shell at ...

Here is a real one. Rutland's 21,253 Land Registry parcels, saved with their coordinates rounded to a 2-metre grid — the kind of damage a coarse export or a careless round() does — clipped to one ward:

try:
    gpd.clip(coarse, ward)
except shapely.errors.GEOSException as exc:
    print(type(exc).__name__ + ":", exc)
GEOSException: TopologyException: unable to assign free hole to a shell at 485988 308720

It often appears when you run:

The usual causes are:

  • invalid or self-intersecting polygons in one of the inputs
  • slivers and tiny artifacts left over from earlier processing
  • nearly coincident edges that GEOS cannot resolve at full coordinate precision
  • coordinates rounded or snapped after the geometry was built

The practical fix is to detect invalid geometries, repair them, optionally reduce coordinate precision, and then retry the operation.

Quick answer

The shortest reliable workflow to get past a TopologyException in GeoPandas is:

  1. check both inputs with .is_valid
  2. repair invalid features with make_valid()
  3. if the error persists, reduce precision with shapely.set_precision()
  4. retry the overlay, intersection, or dissolve
a, b = coarse.copy(), ward.copy()
print("invalid before:", int((~a.is_valid).sum()), "and", int((~b.is_valid).sum()))

# 1. repair invalid geometries in both layers
a["geometry"] = a.geometry.make_valid()
b["geometry"] = b.geometry.make_valid()

# 2. optional: snap coordinates to a millimetre grid to remove precision noise
a["geometry"] = shapely.set_precision(a.geometry.values, grid_size=0.001)
b["geometry"] = shapely.set_precision(b.geometry.values, grid_size=0.001)

# 3. retry the operation
result = gpd.clip(a, b)
print("invalid after:", int((~a.is_valid).sum()), "| clipped parcels:", len(result))
invalid before: 1494 and 0
invalid after: 0 | clipped parcels: 1610

Repair with make_valid() first. Use set_precision() only if the error survives the repair step, and buffer(0) only when make_valid() is unavailable.

Repair order

TopologyException: repair orderBoth inputs .is_valid?make_valid() on both, then retryNoYesStill failing?set_precision(grid_size), thenretryYesNobuffer(0) fallback, or drop the offending rowspatialworkflow.io
The order to repair a TopologyException: validate, set precision, then fall back.

Locate, diagnose and repair the offending rows

Two edges crossing without a shared node, and the same edges after noding. what "non-noded intersection" meansCrossing, no nodeno vertex where they crossGEOS cannot resolve itNodeda shared vertex existsafter make_valid / set_precisionThe coordinate in the error message is exactly where this happens spatialworkflow.io
Overlay operations need every crossing to have a vertex — that is what noding means.

Reproduce the error and read the message

The error message includes the coordinate where GEOS gave up. That coordinate is a clue, not the whole answer, but it tells you roughly where the problem geometry sits — here, in British National Grid metres, a point inside the ward. Which message you get depends on the defect and on the GEOS version:

print("GEOS", shapely.geos_version_string)
messages = Counter()
for geometry in coarse.geometry[~coarse.is_valid]:
    try:
        shapely.intersection(geometry, ward.geometry.iloc[0])
    except shapely.errors.GEOSException as exc:
        messages[re.sub(r" at .*", "", str(exc))] += 1
print(dict(messages))
GEOS 3.13.1
{'TopologyException: side location conflict': 5, 'TopologyException: unable to assign free hole to a shell': 13}

"Found non-noded intersection" did not appear once: GEOS 3.9 replaced the overlay engine with OverlayNG, which retries a failed noding with snapping and snap-rounding before giving up, and that message is now far rarer than it was in older GEOS builds. What remains are the messages above, and they have the same cause and the same fix.

Check validity in both input layers

The most common trigger is an invalid geometry in one of the inputs. Check both layers, not just one:

print("invalid parcels:", int((~coarse.is_valid).sum()), "of", len(coarse))
print("invalid ward:   ", int((~ward.is_valid).sum()))
print("invalid parcels before rounding:", int((~parcels.is_valid).sum()))
invalid parcels: 1494 of 21253
invalid ward:    0
invalid parcels before rounding: 0

The original parcels are all valid; rounding made 1,494 of them invalid. Even a single invalid polygon in either layer can stop the whole operation.

Diagnose the reason with explain_validity()

Finding the count is useful, but the reason tells you what kind of defect you are dealing with:

reasons = coarse.geometry[~coarse.is_valid].apply(explain_validity).str.replace(r"\[.*", "", regex=True)
print(reasons.value_counts().to_dict())
{'Ring Self-intersection': 785, 'Self-intersection': 604, 'Too few points in geometry component': 103, 'Hole lies outside shell': 1, 'Interior is disconnected': 1}

Rounding a narrow parcel's corners to a 2 m grid can fold an edge back over another (Self-intersection), make a ring touch itself (Ring Self-intersection), or collapse a sliver to fewer than three distinct points.

Repair geometries with make_valid()

The preferred repair is make_valid() from Shapely 2. Apply it to both layers:

repaired = coarse.copy()
repaired["geometry"] = repaired.geometry.make_valid()
print("invalid after repair:", int((~repaired.is_valid).sum()))
print("geometry types of the repaired rows:", repaired.geom_type[~coarse.is_valid].value_counts().to_dict())
invalid after repair: 0
geometry types of the repaired rows: {'GeometryCollection': 1199, 'Polygon': 114, 'MultiPolygon': 74, 'LineString': 53, 'MultiLineString': 49, 'Point': 5}

make_valid() never deletes a feature, so most repairs came back as a GeometryCollection mixing polygons with the lines and points that collapsed slivers became, and a hundred parcels became nothing but lines or points. gdf.geometry.make_valid() is the GeoSeries method; shapely.make_valid(geom) works on a single geometry.

Most GeoPandas operations want polygons only, so keep the polygon parts:

def polygon_parts(geometry):
    if geometry.geom_type in ("Polygon", "MultiPolygon"):
        return geometry
    polygons = [p for p in shapely.get_parts(shapely.get_parts(geometry)) if p.geom_type == "Polygon"]
    return shapely.MultiPolygon(polygons) if len(polygons) > 1 else polygons[0] if polygons else shapely.Polygon()

polygonal = repaired.copy()
polygonal["geometry"] = polygonal.geometry.apply(polygon_parts)
polygonal = polygonal[~polygonal.is_empty]
print(polygonal.geom_type.value_counts().to_dict(), "|", len(repaired) - len(polygonal), "parcels had no area left")
{'Polygon': 20829, 'MultiPolygon': 315} | 109 parcels had no area left
From Rutland’s parcels to the few that stop a clip, after rounding every coordinate to 2 m. rounded to a 2 m grid, clipped to one wardRutland parcels21,253is_valid÷ 14invalid after rounding1,494of 1,610 parcels in it÷ 88raise on the ward17band width is log-scaledOne of the 17 is enough to stop gpd.clip spatialworkflow.io
Validity counts from the steps above, and Example 1’s row-by-row test.

Retry the operation

After repair, run the same operation again:

clipped = gpd.clip(repaired, ward)
print(len(clipped), "parcels clipped to", ward["WD24NM"].iloc[0])
1610 parcels clipped to Oakham North East

Many TopologyException cases are solved here. If the error is gone, you are done.

Watch for the operations that do not fail

Not every operation stops on invalid input. With GEOS 3.13, gpd.overlay on the damaged parcels ran to the end — and returned a different answer:

with warnings.catch_warnings(record=True) as caught:
    warnings.simplefilter("always")
    raw = gpd.overlay(coarse, wards, how="intersection")
try:
    gpd.overlay(repaired, wards, how="intersection")
except NotImplementedError as exc:
    print("overlay on the make_valid() output:", exc)
fixed = gpd.overlay(polygonal, wards, how="intersection")
dropped = next((str(w.message)[:90] for w in caught if "dropped" in str(w.message)), None)
print(f"invalid input:  {len(raw):,} pieces, {raw.area.sum() / 1e6:.3f} km² | {dropped}")
print(f"repaired, polygon parts: {len(fixed):,} pieces, {fixed.area.sum() / 1e6:.3f} km²")
print(f"original input: {parcels.area.sum() / 1e6:.3f} km² of parcels")
overlay on the make_valid() output: df1 contains mixed geometry types.
invalid input:  21,519 pieces, 390.541 km² | `keep_geom_type=True` in overlay resulted in 4708 dropped geometries of different geometry
repaired, polygon parts: 21,563 pieces, 390.764 km²
original input: 428.985 km² of parcels

On the damaged layer: no exception, only a warning about dropped geometries that is easy to miss in a log — and 44 fewer pieces and 0.22 km² less area than the repaired run, because the overlay quietly discarded what it could not handle. On the raw make_valid() output: a refusal, because a GeometryCollection is not a polygon. Only the polygon parts go through cleanly. An operation that succeeds on invalid input is not evidence that the input was fine: validate before every overlay, not only after one fails.

Reduce precision with set_precision() if the error persists

If repair alone does not help, the problem is usually precision: two edges that are almost but not exactly coincident. Snapping coordinates to a fine grid forces GEOS to treat near-equal points as equal:

for grid in (0.001, 0.01, 0.1):
    snapped = shapely.set_precision(polygonal.geometry.values, grid_size=grid)
    moved = shapely.hausdorff_distance(snapped, polygonal.geometry.values)
    print(f"grid {grid:>5} m: invalid {int((~shapely.is_valid(snapped)).sum())}, "
          f"empty {int(shapely.is_empty(snapped).sum())}, largest vertex move {np.nanmax(moved):.3f} m")
grid 0.001 m: invalid 0, empty 0, largest vertex move 0.000 m
grid  0.01 m: invalid 0, empty 0, largest vertex move 0.000 m
grid   0.1 m: invalid 0, empty 0, largest vertex move 18.439 m

grid_size is in CRS units; for a projected CRS in metres, 0.001 is a millimetre, and at 1 mm and 1 cm nothing visible moved. At 10 cm three outlines moved by more than a metre — the worst by 18 m, where snap-rounding removed a zero-width spike from a parcel and changed its area by only 2 m². Pick the smallest grid that clears the error: a grid that is too coarse is how this layer got broken in the first place.

Use buffer(0) only as a fallback

buffer(0) repairs some polygon self-intersections, but it does it by throwing parts away:

bad = coarse[~coarse.is_valid]
by_buffer = bad.geometry.buffer(0)
by_make_valid = bad.geometry.make_valid()
print(f"area of the {len(bad):,} invalid parcels: buffer(0) {by_buffer.area.sum():,.0f} m², "
      f"make_valid {by_make_valid.area.sum():,.0f} m²")
print(f"emptied by buffer(0): {int(by_buffer.is_empty.sum())}, by make_valid: {int(by_make_valid.is_empty.sum())}")
area of the 1,494 invalid parcels: buffer(0) 80,689,814 m², make_valid 80,713,184 m²
emptied by buffer(0): 91, by make_valid: 0

For a figure-eight polygon, buffer(0) keeps one lobe and silently drops the other; make_valid() keeps both. Prefer make_valid().

Clipping Rutland's parcels to its wards

The data used on this page

HM Land Registry's INSPIRE parcels for Rutland (© Crown copyright and database rights; OGL) and the county's wards from the ONS December 2024 boundaries (OGL). coarse is the parcels with every coordinate rounded to 2 m, which reproduces the invalid polygons that low-precision exports produce; ward is Oakham North East.

import re
import warnings
from collections import Counter
from pathlib import Path

import geopandas as gpd
import numpy as np
import requests
import shapely
from shapely.validation import explain_validity

Path("data").mkdir(exist_ok=True)
if not Path("data/Rutland.zip").exists():
    Path("data/Rutland.zip").write_bytes(requests.get(
        "https://use-land-property-data.service.gov.uk/datasets/inspire/download/Rutland.zip", timeout=300).content)
if not Path("data/wards.geojson").exists():
    Path("data/wards.geojson").write_bytes(requests.get(
        "https://services1.arcgis.com/ESMARspQHYMw9BZ9/arcgis/rest/services/"
        "Wards_December_2024_Boundaries_UK_BFC/FeatureServer/0/query",
        params={"where": "LAD24CD='E06000017'", "outFields": "WD24NM", "outSR": 27700, "f": "geojson"},
        timeout=120).content)
parcels = gpd.read_file("/vsizip/data/Rutland.zip/Land_Registry_Cadastral_Parcels.gml",
                        columns=["INSPIREID"], DOWNLOAD_SCHEMA="NO")
wards = gpd.read_file("data/wards.geojson")
ward = wards[wards["WD24NM"] == "Oakham North East"]

coarse = parcels.copy()
coarse["geometry"] = shapely.set_precision(parcels.geometry.values, 2, mode="pointwise")   # round every vertex to 2 m
print(len(parcels), "parcels,", len(wards), "wards | GEOS", shapely.geos_version_string)
21253 parcels, 15 wards | GEOS 3.13.1

Example 1: Find the offending rows before a clip

When the error coordinate is not enough, test the operation row by row and catch the exception, so you know exactly which features to inspect:

target = ward.geometry.iloc[0]
candidates = coarse[coarse.intersects(target)]
failures = []
for index, geometry in candidates.geometry.items():
    try:
        shapely.intersection(geometry, target)
    except shapely.errors.GEOSException as exc:
        failures.append((int(coarse.loc[index, "INSPIREID"]), explain_validity(geometry).split("[")[0], str(exc).split(" at ")[0]))
print(len(failures), "of", len(candidates), "parcels in the ward fail; the first three:")
for row in failures[:3]:
    print(" ", row)
17 of 1610 parcels in the ward fail; the first three:
  (31694290, 'Ring Self-intersection', 'TopologyException: side location conflict')
  (31640814, 'Self-intersection', 'TopologyException: unable to assign free hole to a shell')
  (31644721, 'Self-intersection', 'TopologyException: unable to assign free hole to a shell')

Every failing parcel is invalid; not every invalid parcel fails. That is why repairing the whole layer is more reliable than chasing the rows that happen to break one operation.

Example 2: Merging and dissolving

for label, frame in (("damaged", coarse), ("make_valid", repaired), ("polygon parts", polygonal)):
    merged = frame.geometry.union_all()
    print(f"{label:13} union_all: {merged.geom_type:18} {merged.area / 1e6:.3f} km²")
print(f"{'original':13} union_all: {'':18} {parcels.geometry.union_all().area / 1e6:.3f} km²")
damaged       union_all: MultiPolygon       397.984 km²
make_valid    union_all: GeometryCollection 397.985 km²
polygon parts union_all: MultiPolygon       397.985 km²
original      union_all:                    397.985 km²

union_all() and dissolve() ran on the damaged layer without complaint, and all four versions agree on the county's area to within a thousandth of a square kilometre — the damage is local, a few metres at a time. The geometry type is what changes: the raw repair merges into a GeometryCollection because it still carries collapsed lines, which a later step expecting polygons will trip over. (An earlier version of polygon_parts dissolved the parts with union_all and lost 0.18 km² across 35 parcels; flattening them into a MultiPolygon keeps every square metre.)

What noding is, and why it fails

"Noding" is the step where GEOS splits every line at the points where it crosses or touches another line. Each of those crossing points becomes a node. Overlay, union, dissolve, and clip all depend on a correctly noded set of edges before they can build the output polygons.

Escalating repairs for a TopologyException, cheapest first. try these in order1Find which layer is invalidis_valid on both2Read the reason and the coordinateexplain_validity()3Repair with make_valid()fixes most cases4Retry the operationoften enough5Reduce precisionset_precision(0.001)6Buffer(0) as a last resortpolygons onlyset_precision snaps coordinates to a grid — powerful, and it does move your data spatialworkflow.io
Stop at the first step that works; each later one changes the data more.

A "non-noded intersection" means GEOS found two segments that cross at a point that was not turned into a node. A "side location conflict" means it cannot decide which side of an edge is inside and which is outside, and "unable to assign free hole to a shell" means a ring it built as a hole lies in no outer ring. All of them come from the same places: invalid geometry, edges that nearly overlap, or floating-point coordinates that put an intersection a tiny fraction off from where the noding logic expected it.

GeoPandas does not do this work itself. It hands the geometries to Shapely, which calls GEOS, so the error and the fix both live at the GEOS level. That is why the repair workflow is always the same regardless of which GeoPandas function raised it:

  1. make the geometries valid with make_valid()
  2. if needed, reduce coordinate precision with set_precision() so near-coincident edges snap together
  3. retry the operation

Reducing precision works because GEOS uses a fixed precision model when a grid size is set, and snap-rounds every vertex and intersection to that grid. The same mechanism, applied far too coarsely and without repair afterwards, is what damaged this page's layer.

Repairs that change the data

make_valid() can change geometry type

A repaired polygon may come back as a MultiPolygon or a GeometryCollection. If a later step expects polygons only, filter on geom_type before continuing.

polygon_types = ["Polygon", "MultiPolygon"]
gdf = gdf[gdf.geometry.geom_type.isin(polygon_types)].copy()

set_precision() is destructive

Snapping to a grid moves vertices. A grid size that is too large will merge distinct features or collapse thin polygons to nothing. Choose the smallest grid that clears the error.

Precision depends on CRS units

grid_size is expressed in the units of the layer's CRS. In a projected CRS measured in meters, 0.001 is one millimeter. In a geographic CRS measured in degrees, the same number is a much larger distance. Reproject to a projected CRS before snapping if you can.

Both inputs must be repaired

Overlay and clip take two layers. An invalid geometry in either one can cause the error, so always check and repair both, not just the layer you expect to be at fault.

buffer(0) only helps with polygons

It can fix simple polygon self-intersections, but it does nothing useful for lines and can silently delete small parts. Prefer make_valid().

Keep CRS consistent first

Mismatched CRS will not directly cause a noding error, but reprojecting after an overlay is harder than before. Align CRS with to_crs() before running the operation.

FAQ

What does "found non-noded intersection" actually mean?

GEOS found two line segments that cross at a point it did not split into a node, usually because of an invalid geometry or a precision mismatch between near-coincident edges. Repairing geometries and reducing precision resolves most cases.

Will make_valid() always fix the TopologyException?

Often, but not always. If the problem is precision rather than validity, the geometries can be valid and still produce the error. In that case, follow make_valid() with set_precision() and retry.

What grid_size should I pass to set_precision()?

Use a value in your CRS units that is smaller than the detail you need to keep. For a projected CRS in meters, 0.001 (1 mm) is a safe starting point. Increase it only if the error persists.

Should I use buffer(0) or make_valid()?

Use make_valid(). It keeps every part of a self-intersecting polygon, while buffer(0) can silently drop one lobe of a figure-eight. Keep buffer(0) as a fallback for when make_valid() is not available.

Can I make GeoPandas overlay use the slower but more robust GEOS noder?

Recent GEOS handles most overlay noding internally, but if precision is the issue the practical lever is set_precision() with a fixed grid size, which forces a robust fixed-precision overlay. Apply it to both inputs, then retry the operation rather than changing engine settings.

Why does the TopologyException only appear after I reproject my data?

to_crs() recomputes every coordinate, and two layers reprojected separately can end up with edges that were shared and are now a few nanometres apart. Rutland's parcels stayed valid through a reprojection to WGS 84, so it is not guaranteed to happen — but if it does, run make_valid() after reprojecting, then snap both layers with set_precision() in the new CRS units.

How do I isolate the single feature causing the error so I can inspect it?

Use the coordinate in the error message to filter, for example build a small shapely.geometry.Point there and select features whose bounds are near it, or test intersection() row by row in a loop and catch the GEOSException to flag the offending row. Once identified, inspect it with explain_validity() and repair or drop it.