It was a Thursday afternoon, and a colleague had been staring at the same error message for three hours. She was running an intersection between a land parcel layer and a flood zone, a routine operation she had done a hundred times, and the tool kept stopping with a message about a topology exception. She had restarted the program, reprojected the data twice and rebuilt the spatial index. Nothing worked. I asked her to run one command, a validity check on the parcel layer, and the answer came back in four seconds: eleven parcels were invalid, out of forty thousand. Eleven. One of them was a polygon whose outline crossed itself like a bow tie, drawn years ago by someone who had clicked the vertices in the wrong order. It had been sitting quietly in the data, doing no harm, until the day an overlay tool met it.
That story repeats itself in every GIS office I have ever visited. Invalid geometry is the most common hidden fault in spatial data. It rarely announces itself. Maps draw fine, attribute tables look fine, and then an overlay, a dissolve, a buffer or an export fails with a message that seems to have nothing to do with the real problem. The good news is that the problem is well understood, easy to detect and, in most cases, easy to repair. In this guide I’ll explain what makes a geometry invalid, how to recognize the symptoms, how to find the offenders in every major tool, how to repair them safely, and how to stop them from coming back.
This article is a deep dive into the first item of Top 10 Most Common GIS Errors and How to Fix Them.

What Does “Invalid” Mean?
A geometry is valid when it follows the rules of the standard model used by most GIS software and spatial databases (the OGC Simple Features model). These rules exist so that mathematical operations such as area, intersection and union have a single, unambiguous answer.
Rules for polygons
- Rings must be closed: the last vertex equals the first.
- A ring must not cross itself. A bow-tie or figure-eight outline is invalid.
- Rings must not touch or cross each other along a line. They may touch at a single point in some situations, but not overlap.
- Holes (inner rings) must lie inside the outer ring, and must not touch it along a line.
- The interior must be connected. A polygon cannot be made of two pieces joined by nothing.
- A ring needs at least four coordinates (three distinct points plus the closing point), and must enclose an area.
- Coordinates must be real numbers: no NaN or infinity values.
Rules for lines
- At least two distinct points. A line with all vertices in the same place is degenerate.
- No invalid coordinates.
(A line is allowed to cross itself, which is valid but “not simple”, and which matters in network analysis.)
Other conditions often called “invalid” or “bad”
- Empty geometries: a feature with a geometry that has no coordinates.
- Null geometries: a feature with no geometry at all.
- Duplicate vertices: repeated consecutive points. Not always invalid, but troublesome.
- Spikes and slivers: a very thin, needle-like part, sometimes valid, sometimes not.
- Incorrect ring orientation: some formats expect outer rings to run clockwise and holes counterclockwise. Most software tolerates this, but not all.
Software differences
Different programs define “valid” slightly differently. A geometry that Esri software accepts as “simple” may be flagged by the GEOS library used by QGIS, PostGIS and Shapely, and the reverse. A classic example: a polygon whose ring touches itself at a point, forming an “inverted” shape, is accepted in some contexts and rejected in others. This is why a file can open perfectly in one program and fail in another. Check validity with the tool that will perform the operation.
How Invalid Geometry Gets Into Your Data
Knowing the origins helps you prevent recurrences.
- Manual digitizing: clicking vertices in the wrong order, crossing a boundary, leaving a ring unclosed or clicking twice at the same spot.
- Format conversion: from CAD drawings (which have no concept of polygon validity), from scanned data or from older systems.
- Automatic vectorization: converting a raster to polygons can create tiny, awkward shapes.
- Generalization and simplification: reducing vertices can make rings cross themselves.
- Reprojection: transforming a polygon can create self-intersections, especially near the poles and where polygons cross the antimeridian (the 180-degree meridian).
- Overlay and geoprocessing: the output of one tool may contain slivers and degenerate pieces that break the next tool.
- Snapping and coordinate precision: rounding coordinates can collapse a thin polygon into a line, or make an edge touch another.
- GPS tracks turned into polygons: noisy, self-crossing outlines.
- Data loaded from text: polygons created from WKT or coordinates in the wrong order.
- Edits by many people without validation rules.
- Pole and antimeridian cases: world-spanning polygons stored in latitude and longitude can look invalid or draw as stripes across the map.
Symptoms: How Invalid Geometry Shows Up
The problem seldom says “invalid geometry”. Look for these clues.
- An overlay or analysis tool fails with messages mentioning “invalid geometry”, “topology exception”, “side location conflict”, “self-intersection”, “ring” or “GEOS”.
- A tool “succeeds” but features are missing from the output, because invalid features were silently skipped.
- Area or length is zero or absurd for a feature that obviously has size.
- Dissolve, union or buffer give errors or strange results, such as spikes and holes in the wrong places.
- Export to another format fails, or the output has fewer features than the input.
- Features draw strangely: a polygon with a bow-tie, or a filled shape with a hole in the wrong place.
- A database refuses an insert because of a geometry constraint.
- Spatial queries return inconsistent results.
- Clipping works on some features and not others.
- A feature can’t be selected or edited properly.
If you see any of these, run a validity check before anything else. It is the cheapest diagnostic there is.
Step 1: Find the Invalid Geometries
In QGIS
- Open the Processing Toolbox and search for Check validity (in Vector geometry).
- Choose the input layer and a validation method. QGIS offers its own checks and the GEOS checks (the same used by PostGIS). The GEOS method matches what most analysis tools use.
- Run it. You get three outputs: valid features, invalid features and error locations (points showing where each problem is, with a message).
- Open the error output and read the messages. They say things like “Self-intersection” and give the position.
- For interactive checking and fixing, the Geometry Checker plugin (a core plugin you can enable) can detect many problem types, such as self-intersections, duplicate nodes, slivers, overlaps and gaps, and offers fixes.
You can also set QGIS to validate geometries as you digitize in Settings > Options > Digitizing, which warns you when you create an invalid feature.
In ArcGIS Pro
- Use the Check Geometry tool (Data Management toolbox). It produces a table listing each problem feature and the problem type, such as short segment, self-intersection, null geometry, incorrect ring ordering or unclosed ring.
- Use the Repair Geometry tool afterwards (see below).
In PostGIS
-- Which features are invalid, and why?
SELECT id, ST_IsValidReason(geom) AS reason
FROM parcels
WHERE NOT ST_IsValid(geom);
-- Where exactly is the problem? (location of the error)
SELECT id, ST_AsText((ST_IsValidDetail(geom)).location) AS where_is_it
FROM parcels
WHERE NOT ST_IsValid(geom);The second query uses ST_IsValidDetail, which returns the validity flag, the reason and the location of the first problem. Check your version’s documentation for exact usage. You can also count them:
SELECT count(*) FILTER (WHERE NOT ST_IsValid(geom)) AS invalid,
count(*) FILTER (WHERE geom IS NULL) AS null_geoms,
count(*) FILTER (WHERE ST_IsEmpty(geom)) AS empty_geoms,
count(*) AS total
FROM parcels;A bow-tie polygon shows the kind of message you get:
SELECT ST_IsValid(ST_GeomFromText('POLYGON((0 0, 10 10, 10 0, 0 10, 0 0))'));
-- false
SELECT ST_IsValidReason(ST_GeomFromText('POLYGON((0 0, 10 10, 10 0, 0 10, 0 0))'));
-- Self-intersection[5 5]See Spatial SQL Cheat Sheet for more.
In Python with GeoPandas and Shapely
import geopandas as gpd
from shapely.validation import explain_validity
gdf = gpd.read_file("parcels.gpkg")
invalid = gdf[~gdf.is_valid]
print(len(invalid), "invalid of", len(gdf))
# Why is each one invalid?
invalid = invalid.assign(reason=invalid.geometry.apply(explain_validity))
print(invalid[["reason"]].head())
# Null and empty geometries
print("null:", gdf.geometry.isna().sum(), "empty:", gdf.geometry.is_empty.sum())With GDAL
GDAL can read and convert most data, and recent versions include an option to repair geometries on the fly during conversion (the -makevalid option of ogr2ogr). Check ogr2ogr --help for your version.
Write down what you find
Record the number of invalid features, their IDs and the reasons. You will need them to check that the repair worked, and to talk to the data provider if the problem is theirs.
Step 2: Understand Before You Repair
Repair is a modification of your data. Before you do it, spend a minute thinking.
- Back up the original. Never repair in place without a copy.
- Look at a few offenders on the map. Is the problem a tiny spike or a big, obvious mistake? Is it a data entry error, or a result of processing?
- Count and measure: the number of features, the total area or length and the geometry types before repair. You’ll compare afterward.
- Decide what a correct result should look like. A bow-tie polygon can be repaired in several ways, and the “right” one depends on what it was meant to be.
Step 3: Repair
Automatic repair
QGIS
Use Fix geometries from the Processing Toolbox (Vector geometry). It creates a corrected copy of the layer. Recent versions offer more than one repair method, which differ in how they treat self-intersecting rings. After running it, re-run Check validity on the output to confirm that no problems remain. Using the Fix geometries output as the input for your overlay is the quickest fix for the failing intersection in my opening story.
You can also tell Processing how to treat invalid features generally, in Settings > Options > Processing > General, under Invalid feature filtering: skip invalid features, stop with an error, or do not filter. The safest practice is to stop and fix rather than to skip silently.
ArcGIS Pro
Use Repair Geometry (Data Management toolbox). It modifies the input feature class directly, so run it on a copy. It can optionally delete features with null geometries. After repair, run Check Geometry again.
PostGIS
-- Repair invalid geometries in place (work on a copy of the table first!)
UPDATE parcels
SET geom = ST_MakeValid(geom)
WHERE NOT ST_IsValid(geom);ST_MakeValid rebuilds the geometry so that it is valid while keeping as much of the original area and linework as possible. A bow-tie polygon typically becomes two triangles, in a multipolygon. Because the result can change type, keep the layer’s geometry type consistent:
-- Keep only the polygon parts, and make the result a multipolygon
UPDATE parcels
SET geom = ST_Multi(ST_CollectionExtract(ST_MakeValid(geom), 3))
WHERE NOT ST_IsValid(geom);ST_CollectionExtract(geom, 3) keeps only polygons (1 is points and 2 is lines). Newer versions of the underlying library offer choices of repair method, so check the documentation for your version.
Shapely and GeoPandas
from shapely import make_valid
from shapely.validation import explain_validity
from shapely import wkt
bowtie = wkt.loads("POLYGON((0 0, 10 10, 10 0, 0 10, 0 0))")
print(bowtie.is_valid, explain_validity(bowtie)) # False Self-intersection[5 5]
fixed = make_valid(bowtie)
print(fixed.geom_type, fixed.area) # a MultiPolygon with area 50
# Repair a whole layer
gdf["geometry"] = gdf.geometry.apply(make_valid)
print(gdf.is_valid.all())If the layer must contain only polygons, filter out any non-polygon pieces after repair (make_valid may return a geometry collection that includes stray lines or points):
from shapely.geometry import MultiPolygon, Polygon
def keep_polygons(geom):
if geom.geom_type in ("Polygon", "MultiPolygon"):
return geom
parts = [g for g in getattr(geom, "geoms", []) if g.geom_type in ("Polygon", "MultiPolygon")]
if not parts:
return None
polys = []
for p in parts:
polys.extend(p.geoms if p.geom_type == "MultiPolygon" else [p])
return MultiPolygon(polys) if len(polys) > 1 else polys[0]
gdf["geometry"] = gdf.geometry.apply(keep_polygons)The “buffer by zero” trick, and why to avoid it
You will often read that buffer(0) fixes any invalid polygon. It sometimes works, because buffering rebuilds the geometry. But it can silently discard part of the shape, for example one lobe of a bow-tie, and so it loses area without telling you. Prefer the dedicated repair functions (make_valid, ST_MakeValid, Fix geometries, Repair Geometry), and always compare areas before and after.
Manual repair
When the problem is a clear digitizing error, the best repair is by hand.
- Zoom to the error location (the point output of the validity check).
- Use the vertex tool to move, delete or insert vertices. In QGIS, the Vertex Editor panel lists coordinates and lets you edit them precisely.
- Remove duplicate vertices (QGIS: Delete duplicate vertices, ArcGIS: Repair Geometry handles many).
- Redraw the feature if it is badly damaged.
- Re-run the validity check.
For a handful of features this is quick and gives the best result. For thousands, use automatic repair and inspect a sample.
Special cases
- Null and empty geometries. Decide whether the records are meaningful. A parcel record without a shape may still carry useful attributes. Either restore the shape, keep the record in a table, or delete it, but document the decision.
- Duplicate vertices and very short segments. Remove them with a tool for duplicate vertices, or by snapping coordinates to a grid. In PostGIS,
ST_SnapToGridandST_ReducePrecision(available in recent versions) round coordinates to a chosen precision, which can resolve tiny problems. Use a grid size that is far smaller than your data’s real accuracy. - Slivers and spikes. Thin parts may be valid but unwanted. See Fixing Topology Errors and Overlaps.
- Polygons crossing the antimeridian. A world-spanning polygon in latitude and longitude may need to be split at 180 degrees, or stored in a different way. Don’t try to repair it as an ordinary self-intersection.
- Curved geometries. Some geodatabases support true curves, which some tools convert to many straight segments. Conversion can introduce problems.
- Z and M values: a valid 2D shape can still cause trouble in a column that expects only 2D. Remove the extra dimensions, with
ST_Force2Din PostGIS, if you don’t need them.
Step 4: Verify the Repair
Repair isn’t finished until you have checked.
- Re-run the validity check. The count of invalid features should be zero.
- Compare the number of features before and after. Repair can split a feature into several parts, or remove empty ones.
- Compare the total area or length. A small change is normal, but a big loss suggests that a repair method discarded parts of the shape.
- Compare geometry types. A polygon layer that now contains a collection or lines needs cleanup.
- Look at a sample of the repaired features on the map, against the originals.
- Check attributes: a feature that was split keeps the same attributes in each part, which can double count in summaries. Aggregate before you sum.
- Run the failing analysis again and see if it works.
- Document what you did: the tool, the date, the number of features repaired and any decisions.
A short script that does the verification:
import geopandas as gpd
from shapely import make_valid
before = gpd.read_file("parcels.gpkg")
after = before.copy()
after["geometry"] = after.geometry.apply(make_valid)
print("invalid before:", (~before.is_valid).sum(), " after:", (~after.is_valid).sum())
print("features:", len(before), "->", len(after))
print("total area:", round(before.area.sum(), 2), "->", round(after.area.sum(), 2))
print(after.geom_type.value_counts())(Calculate areas in a projected CRS. See Coordinate Reference Systems (CRS) Explained Simply.)
A Worked Example: The Parcel Layer That Wouldn’t Intersect
Problem: an intersection of 40,000 parcels with a flood zone fails with a topology exception.
- Hypothesis: an invalid geometry is the cause, since the error comes from the geometry engine.
- Check validity of both layers. The flood zone is fine. The parcels return 11 invalid features, mostly “self-intersection” and one “too few points”.
- Look at the offenders. Nine are bow-ties or small self-crossings near corners. One is a ring with only two distinct points. One is a ring that touches itself.
- Back up the layer, and record the 11 IDs and reasons.
- Repair with the automatic tool in the GIS. Total area changes by a tiny fraction of a square meter.
- Handle the degenerate one by hand: look up the owner record and find that the parcel was merged into a neighbor years ago. Delete the feature, and note the decision.
- Verify: re-run the validity check (0 invalid), compare feature counts and areas, inspect a sample.
- Re-run the intersection. It works.
- Report to the data owner the 11 IDs and the causes, so that the source is corrected.
- Add a validity check to the team’s import checklist, so it happens before any analysis.
Total time: under an hour, instead of an afternoon of misdirected effort.
Prevention: Make Invalid Geometry Rare
- Validate on import, every time. Make it a habit before any analysis. A few seconds of checking saves hours.
- Validate after major processing, such as overlays, simplification and reprojection.
- Turn on digitizing validation and snapping in your editing software.
- Use topology rules in geodatabases to stop invalid or overlapping edits at the source. See Enterprise GIS & Spatial Databases: PostGIS, Geodatabases, and Server Architecture.
- Train editors to digitize carefully, and to use tools that close rings and snap automatically.
- Avoid unnecessary format conversions, especially from CAD.
- Be careful with simplification tolerances, and with coordinate precision rounding.
- Use consistent, appropriate coordinate systems. See Map Projections: How to Choose the Right One.
- Add database constraints where appropriate, such as a check that geometries are valid. See PostGIS: A Practical Introduction.
- Automate checks in scripts and models. See Automating Workflows with ModelBuilder and QGIS Processing and GeoPandas and Shapely: Vector Data in Python.
- Document known issues in the metadata. See Metadata in GIS: Why It Matters and How to Create It.
- Send problems back to the source. If an authority supplies invalid data, tell them. They will usually fix it.
Quick Reference: Symptom, Cause, Fix
| Symptom or message | Likely cause | Fix |
|---|---|---|
| Topology exception, side location conflict | Self-intersecting or otherwise invalid geometry | Check validity, then repair |
| Tool runs, but features are missing | Invalid features skipped silently | Check validity, set filtering to stop, repair |
| Self-intersection reported | Bow-tie or ring crossing itself | Automatic repair, or redraw by hand |
| Too few points | A degenerate ring or line | Delete or redraw the feature |
| Ring not closed | First and last coordinates differ | Close the ring, or repair |
| Hole outside shell, nested holes | Interior ring misplaced | Repair, or edit the ring |
| Zero area or length | Collapsed or empty geometry | Inspect, restore or remove |
| Repair changed the area a lot | Method discarded part (for example buffer(0)) | Use a proper repair tool, and compare areas |
| Layer geometry type changed after repair | Repair produced a collection | Extract the right type, and use multi types consistently |
| Works in one program, fails in another | Different validity definitions | Validate with the tool that will perform the operation |
| Polygon stripes across the world map | Antimeridian crossing | Split at 180 degrees, or use a suitable storage approach |
Common Mistakes
- Ignoring the problem and trying other fixes first, such as reprojecting or rebuilding indexes.
- Skipping the validity check and going straight to analysis.
- Repairing without a backup.
- Using
buffer(0)blindly and losing parts of shapes. - Not comparing before and after, and trusting the repaired data.
- Letting tools skip invalid features silently, so results are quietly incomplete.
- Repairing once and forgetting, while the source keeps producing new invalid features.
- Mixing geometry types after repair.
- Forgetting that split features duplicate attributes.
- Not telling the data provider.
- Assuming that “draws fine” means “valid”.
Final Thoughts
Invalid geometry is the kind of problem that makes people doubt their tools, their data and their sanity, and then turns out to be eleven polygons out of forty thousand. The remedy is a habit, not a heroic effort: check validity early, repair carefully, verify the result, and fix the source. After a few months, it becomes as automatic as checking the coordinate system.
Run a validity check on the most important layer you work with this week. If it comes back clean, enjoy the feeling. If it doesn’t, you have just saved yourself from a failure that was waiting to happen.
Where to go next: continue with Fixing Topology Errors and Overlaps for gaps, slivers and shared-boundary problems, and Layer Not Aligning? Solving CRS Mismatch Problems for positional errors.



