Erase vs Difference in GIS
Learn how Erase and Difference subtract overlapping geometry in GIS, why the input order matters, and how they differ from Intersect and Symmetrical Difference.
Explain Erase and Difference as one-sided spatial subtraction operations, clarify that different GIS systems use different names for closely related behaviour, and establish the distinctions from Intersect, Clip, and Symmetrical Difference.
Erase vs Difference in GIS
Erase and Difference usually describe the same basic spatial idea: subtract the geometry of one layer from another and keep what remains of the input. QGIS calls this operation Difference, while ArcGIS Pro provides an Erase tool with closely related behaviour.
If polygon A overlaps polygon B, calculating the Difference of A using B—or erasing B from A—keeps the parts of A that fall outside B. The overlap disappears.
The most important thing to understand is that this operation is directional. Subtracting B from A is not the same as subtracting A from B. You need to decide which geography you want to preserve before choosing the input and erase or overlay layers.
Erase and Difference at a glance
Column 1: Core idea; Difference: Subtract overlay geometry from input geometry; Erase: Remove erase geometry from input geometry
Column 1: Output; Difference: Parts of the input outside the overlay; Erase: Parts of the input outside the erase features
Column 1: Does input order matter?; Difference: Yes; Erase: Yes
Column 1: Keeps the overlap?; Difference: No; Erase: No
Column 1: Keeps the non-overlapping part of the second layer?; Difference: No; Erase: No
Column 1: Common terminology in; Difference: QGIS, geometry APIs and spatial databases; Erase: ArcGIS and some GIS workflows
Column 1: Typical question; Difference: What remains of A after B is removed?; Erase: What remains of my input after the erase area is removed?
The names are different, but the conceptual question is often the same:
What part of my input remains outside the geometry I want to subtract?
Difference is spatial subtraction
Suppose a parcel polygon extends partly into a restricted zone.
If you calculate:
Parcel − Restricted zonethe result contains only the portion of the parcel outside the restricted zone.
QGIS describes Difference as extracting the parts of input features that do not fall within the overlay layer. When an input feature only partially overlaps the overlay, it is split at the overlay boundary and only the portion outside is retained. QGIS Documentation — Difference
The overlay layer is therefore being used as geometry to subtract. Its non-overlapping portions do not become output features.
That last point distinguishes Difference from operations that preserve geography from both inputs.
Erase expresses the same idea from the action being performed
ArcGIS uses the name Erase for an operation that takes input features and erase features, removes the coincident portions, and copies the remaining portions of the input to the output. ArcGIS Pro Documentation — Erase
The terminology emphasises the action:
Use these features to erase part of my input.
Difference emphasises the result mathematically:
Return the difference between my input and the geometry being subtracted.
For many ordinary vector-overlay workflows, these are two names for the same conceptual operation.
That does not mean every implementation is interchangeable. Supported geometry types, attribute behaviour, precision controls, performance characteristics, and other options can differ between software packages. When moving a workflow between tools, verify those implementation details rather than assuming that matching concepts guarantee identical outputs.
Input order matters
Difference is unlike a symmetrical comparison because one input is privileged.
If:
A − Bmeans “remove B from A”, the result must be a portion of A.
Reversing the operation:
B − Ameans “remove A from B”, producing a portion of B instead.
PostGIS makes this especially explicit in ST_Difference(A, B): the result is the part of A that does not intersect B, and reversing the arguments changes which geometry can survive. PostGIS — ST_Difference
Consider a protected area overlapping a proposed development zone.
If the question is:
Which part of the development zone lies outside the protected area?
then the development zone is the input you want to preserve:
Development − Protected areaBut if the question is:
Which part of the protected area is not affected by the development zone?
the operation is reversed:
Protected area − DevelopmentThe same two layers produce different answers because the questions are different.
What happens when there is no overlap?
Difference is easiest to understand by considering several geometric cases.
No overlap
If B does not touch A, then:
A − B = AThere is nothing to remove, so the input survives unchanged geometrically.
Partial overlap
If B covers part of A, the overlapping portion is removed and the remaining portion of A survives.
This may split one input feature into several disconnected pieces.
Complete coverage
If B completely covers A, nothing remains of A.
Depending on the software and data model, the result may contain no corresponding feature or an empty geometry at the lower-level geometry-function level.
B entirely inside A
If B lies completely inside polygon A, subtracting it can create a hole in A.
This is an important case because Difference does not necessarily reduce the result to a smaller solid polygon. It can change the topology of the input geometry by creating interior rings or disconnected components.
Difference is not Intersect
Difference and Intersect are complementary ways of treating an overlap.
Given A and B:
Intersect asks:
What part belongs to both A and B?
Difference asks:
What part of A does not belong to B?
Conceptually:
Intersect: A ∩ B
Difference: A − BSuppose a road crosses a flood zone.
An intersection can return the portion of road inside the flood zone.
A difference can return the portion of road outside the flood zone.
The two operations use the same spatial relationship but preserve opposite parts of the input.
For the broader overlay comparison, Clip vs Intersect vs Union explains how Intersect fits into the main overlay family.
Difference is not Clip
Clip also removes part of an input feature, which makes it another easy operation to confuse with Difference.
But Clip normally keeps the part inside the clipping area.
Difference keeps the part outside the subtracting area.
If B is used against A:
Clip A by B → keep A inside B
Difference A − B → keep A outside BIn a simple case, the two operations divide A into complementary pieces.
Suppose a national road layer crosses a project boundary.
If you want only the road sections inside the project area, Clip is appropriate.
If you want the road sections outside the project area, Difference is the corresponding operation.
The Common GIS Vector Operations Explained pillar places both operations within the larger overlay family.
Difference is not Symmetrical Difference
The word difference also appears in Symmetrical Difference, but the operation answers a different question.
Ordinary Difference is directional:
A − BOnly geography originating from A can survive.
Symmetrical Difference asks for areas belonging to either input but not both.
Conceptually:
(A − B) + (B − A)So if two polygons partially overlap, Symmetrical Difference retains:
the part belonging only to A;
the part belonging only to B;
while removing their shared area.
Ordinary Difference retains only one of those sides.
This gives a useful rule:
If you want to subtract one layer from another, use Difference or Erase. If you want the non-overlapping portions from both layers, use Symmetrical Difference.
The erase layer does not normally contribute its attributes
Difference and Erase are primarily concerned with removing geometry from the input.
The second layer tells the operation where to subtract; its attributes generally do not need to become part of the result.
For example, suppose a parcel contains:
parcel_id: P105; owner: Example owner; area_ha: 14.2
and the erase layer contains:
restriction_id: R17; category: Protected
After subtracting the protected area, the remaining geometry is still derived from parcel P105. The restriction feature served as the geometry used for subtraction.
If you need the result to describe attributes from both layers, an operation such as Intersect may be more appropriate for that part of the analysis.
Stored area and length values may become wrong
Changing geometry does not necessarily update attributes that were calculated earlier.
Suppose a parcel originally has:
area_ha = 14.2and Difference removes 30 percent of its geometry.
The new polygon is smaller, but a stored area_ha field may still contain 14.2.
QGIS explicitly warns that Difference modifies feature geometry without automatically recalculating stored attributes such as area or length.
The geometry may therefore be correct while the attribute table contains measurements describing the old geometry.
Whenever an overlay changes shape, identify fields derived from geometry and recalculate them if they are still needed.
This same issue applies to operations such as Clip.
One input feature can become several output pieces
Imagine a long polygon crossed by two erase areas.
Before:
+--------------------------------+
| A |
+--------------------------------+After removing two sections, the surviving geometry might look conceptually like:
+------+ +------+ +------+
| A | | A | | A |
+------+ +------+ +------+Those pieces may remain parts of one multipart feature or become separate features depending on the operation and software.
This means a Difference result can have a more complicated geometry structure than the input even though the conceptual operation is merely subtraction.
Feature counts should therefore not be used as the only check that the operation worked.
Inspect the actual geometry and how multipart outputs are represented.
Boundaries that almost coincide can create slivers
Overlay operations depend on the coordinates of their boundaries.
Two polygons may appear to share the same border at normal map scale while their vertices differ slightly. Subtracting one from the other can then leave narrow strips or tiny polygon fragments.
Those fragments can look like errors in Difference, but the operation may simply be exposing disagreement between the source geometries.
Deleting them automatically can hide the underlying data-quality issue.
Before treating a small result as meaningless, ask:
Are the two boundaries supposed to represent the same real-world boundary?
Do they come from different sources or dates?
Were they digitised at different scales?
Is there an appropriate precision or snapping rule for the workflow?
Would removing the fragment change a real geographic distinction?
The later Why Do Overlay Operations Create Tiny Fragments? article can treat this problem in more depth.
Geometry validity still matters
Difference requires the overlay engine to construct new geometry from input boundaries.
Invalid polygon geometry—such as certain self-intersections—can cause failures, unexpected outputs, or geometry repairs depending on the software.
This does not mean that every dataset should be modified automatically before Difference. Repairing invalid geometry can itself change the source shape.
If an overlay fails, first establish whether geometry validity is actually the cause and preserve the original data before applying destructive fixes.
The supporting What Makes a Geometry Invalid? article owns the broader validity question.
Difference is useful for exclusion questions
Difference and Erase are particularly natural when the question contains phrases such as:
outside;
excluding;
remove the area covered by;
remaining after;
unaffected by;
not within.
Examples include:
Which parcels remain outside the proposed acquisition area?
Which sections of habitat are not covered by the development footprint?
What part of this service region lies outside the flood zone?
Which road segments remain after sections inside the closure zone are removed?
In each case, there is a clear input whose remaining geography is the intended result.
Sometimes you do not need to create new geometry
Suppose you want to know which buildings are completely outside a flood zone.
If you only need to identify or filter those buildings and do not need buildings crossing the boundary to be cut into new geometry, a spatial predicate or selection may be enough.
Difference becomes useful when the remaining geometry itself matters.
For example, if a parcel partly overlaps a restriction and you need the exact unrestricted portion, subtraction is appropriate.
This follows a broader principle across vector processing: do not construct new geometry merely because an overlay tool can answer a related question. Use the simplest operation that creates the output you actually need.
Erase vs Difference: which should you choose?
In many cases, you do not really choose between them.
You choose the operation available in your GIS environment.
If your software calls the operation Difference, think:
Return the part of my input after the overlay geometry is subtracted.
If it calls the operation Erase, think:
Use these features to erase overlapping portions of my input.
The underlying analytical decision is the same:
identify the input geography you want to preserve;
identify the geometry you want to subtract;
verify that the remaining pieces represent the intended result;
recalculate geometry-derived attributes if necessary.
The tool name matters less than getting that direction correct.
The key question is what should remain
Difference and Erase are best understood as one-sided spatial subtraction.
They do not preserve the overlap like Intersect. They do not keep the inside like Clip. They do not retain the non-overlapping areas of both inputs like Symmetrical Difference.
They answer a narrower question:
What remains of this input after that geography is removed?
Once you can clearly identify this input and that geography, the operation becomes straightforward.
And because reversing them changes the answer, that distinction should be made before the processing starts—not after looking at the resulting map.
References
QGIS Documentation — Difference. Documents Difference as subtracting overlay geometries from the input, splitting partially overlapping features and retaining only the portions outside the overlay. Open QGIS Difference documentation
ArcGIS Pro Documentation — Erase. Defines Erase as removing the portions of input features that coincide with erase features and retaining the remaining input geometry. Open ArcGIS Pro Erase documentation
PostGIS — ST_Difference. Defines geometric difference as the part of geometry A that does not intersect geometry B and makes the directionality of the operation explicit. Open PostGIS ST_Difference documentation