OnlineMapMaker logo

Symmetric Difference Tool: GeoJSON & Shapefile

Draw or upload two polygon layers and keep only the parts that do not overlap between them. Open fullscreen ↗

Rate this tool:
Advertisement
Advertisement
Loading map…
Need assistance with your GIS project?Explore Our Services

What Is a Symmetric Difference in GIS?

Symmetric difference (also called XOR, or exclusive or) is a vector overlay operation that keeps only the parts of two polygon layers that do not overlap, discarding the shared area entirely. Anywhere you need to find what changed between two boundaries, whether that's an old zoning line against a new one, or two coverage areas you want to compare, this tool answers it. This tool runs the full calculation locally in your browser: draw two shapes directly on the map, or upload a GeoJSON file or a zipped Shapefile, and it works as a self-contained GeoJSON and Shapefile symmetric difference tool without sending your data anywhere. The map itself loads with no basemap by default, so the tool starts fast and light; switch a basemap on from the sidebar only if you want street or satellite context underneath your layers.

How to Add Your Polygon Layers

There are two ways to get polygons into the tool before running a symmetric difference, and both accept GeoJSON or a zipped Shapefile:

  • Draw on the map: Click "Draw Polygon", click the map to place corners, then double-click, press Enter, or click Finish to close the shape. Repeat to add a second polygon.
  • Upload a file: Drag and drop a .geojson file or a zipped Shapefile (.zip with .shp/.dbf/.shx inside) anywhere on the map, or use the Upload button. Only Polygon and MultiPolygon features are read in; points and lines are skipped.

Once you have at least two polygon layers, pick one as Layer A and the other as Layer B in the sidebar, then click "Find Symmetric Difference" to keep only the area where they don't overlap.

How the Symmetric Difference Algorithm Works

Symmetric difference has a simple set-theory definition: it's every point that belongs to Polygon A or Polygon B, but not to both. Written as a formula, A ⊕ B = (A ∪ B) − (A ∩ B), the union of the two shapes minus their intersection. There's a second, equivalent way to write the same operation that is actually easier to compute reliably: A ⊕ B = (A − B) ∪ (B − A), the parts of A with B erased, combined with the parts of B with A erased. This tool uses the second form.

That choice matters because computing a full union first and then subtracting an intersection from it means running two separate boolean overlay operations back to back, and any rounding error in the first one propagates into the second. Running two independent difference operations instead, one for A minus B and one for B minus A, and simply placing both results in the same output layer, needs no shared intermediate geometry at all, and each half can fail independently without breaking the other. If a real-world dataset has one badly formed ring, this tool still returns whichever half succeeded, tagged so you know which is which.

The Pipeline This Tool Runs

  1. Dissolve each input layer: If a layer has more than one feature, every polygon inside it is merged into a single geometry first with a boolean union, so the layer behaves as one shape rather than a list of separate parts.
  2. Run A minus B: The dissolved Layer A geometry and the dissolved Layer B geometry are passed to the same sweep-line boolean difference algorithm this site's Polygon Difference Tool uses, keeping only the part of A that falls outside B.
  3. Run B minus A: The same algorithm runs a second time with the layers swapped, keeping only the part of B that falls outside A.
  4. Tag and combine both halves: Each surviving piece is labelled A only or B only in its properties and placed into one output layer, so the result always shows exactly where the two inputs disagree.
  5. Total the exclusive area: The area of every output feature is summed with a spherical area formula and shown in hectares, square kilometres and acres, so you get a number as well as a shape.

Each of the two difference passes is itself a Martinez–Rueda-style sweep-line boolean clipping algorithm: it sorts every edge endpoint left to right, sweeps a vertical line across the data, and classifies every resulting segment as inside or outside the other polygon using winding rules, the exact same engine and the exact same math this site's Polygon Intersection and Polygon Difference tools use. Symmetric difference doesn't need a new clipping algorithm, it just needs the existing one called twice with the operands swapped.

Real-World Use Cases

📐
Survey and deed boundary disputes
Overlay a professionally surveyed property boundary against the boundary recorded in a deed to isolate the exact sliver of disputed land where the two disagree.
🗺️
Zoning and boundary change detection
Load an old zoning boundary as Layer A and the newly proposed boundary as Layer B to see exactly which areas were added and which were removed in one combined result, instead of comparing two maps by eye.
🛰️
Satellite land-cover change detection
Compare a land classification polygon layer from one year against the same area from a later year to isolate exactly which parcels changed classification, without needing to inspect every polygon by hand.
📡
Telecom coverage comparison
Compare two carriers' coverage polygons to isolate the areas served by exactly one network but not the other, the parts that matter most for a competitive coverage analysis.
🌊
Flood zone map updates
Compare an older FEMA-style flood zone boundary against an updated one to highlight exactly which properties were newly added to, or removed from, the flood risk area.
🗳️
Redistricting and electoral boundary review
Load a current electoral district boundary and a proposed redraw to see precisely which areas, and which voters, would move between districts.

Frequently Asked Questions

How is symmetric difference different from a regular difference (erase)?
A regular difference is one-directional: it subtracts Layer B from Layer A and keeps only what's left of A. Symmetric difference is two-directional: it keeps the exclusive part of A and the exclusive part of B, so you see what changed on both sides, not just one.
Why does the map start without a basemap, and how do I turn one on?
The map loads with no street or satellite tiles by default so the tool opens quickly and keeps the focus on your polygons. Check the "Show basemap" box in the sidebar whenever you want geographic context, and choose Street or Satellite once it's on.
Is my data uploaded anywhere?
No. Drawing, file reading, the dissolve step, both difference passes, and the final area calculation all happen locally in your browser using JavaScript. Nothing is sent to a server.
Can I upload a GeoJSON or Shapefile, or only draw?
Both. Draw directly on the map, drop a .geojson file, or drop a zipped Shapefile (.zip containing .shp, .dbf and .shx). All three input methods can be mixed for Layer A and Layer B.
Which GIS software has a built-in symmetric difference tool?
PostGIS has ST_SymDifference as a SQL function, QGIS has a "Symmetrical Difference" algorithm in its Processing Toolbox, ArcGIS Pro has a Symmetrical Difference geoprocessing tool, and Python's Shapely has a .symmetric_difference() method. All compute the same result this tool does.
What algorithm computes the symmetric difference, and is it accurate?
The tool runs a Martinez–Rueda-style sweep-line boolean difference algorithm twice, once for A minus B and once for B minus A, the same engine used by this site's Polygon Difference and Polygon Intersection tools. It correctly handles concave polygons and polygons with holes.
What is a symmetric difference in GIS?
Symmetric difference is a vector overlay operation that keeps only the area belonging to exactly one of two polygon layers, not both. It's written A ⊕ B = (A ∪ B) − (A ∩ B): everything in either shape, minus whatever they share.
Does this tool show the overlapping area too, or only the non-overlapping parts?
Only the non-overlapping parts. The shared, overlapping area is deliberately discarded, that's the entire point of a symmetric difference. If you need the overlap itself, this site's Polygon Intersection Tool computes exactly that.
How do I find the parts of two polygons that do not overlap?
Draw or upload two polygon layers, pick them as Layer A and Layer B in this tool, and click "Find Symmetric Difference". The overlapping area is discarded entirely, and only the two non-overlapping pieces remain in the result.
Can I use this with multiple polygons per layer?
Yes. If a layer has more than one feature, they are first merged into a single shape with a boolean union, so the symmetric difference is computed between the two layers as wholes, not feature by feature.
Advertisement
Advertisement

Exporting Your Results

Every layer can be exported independently, or you can export everything at once:

  • Single layer export: The download icon next to any layer exports just that layer's features as a standalone .geojson file.
  • Export everything: The "Download All Layers" button combines Layer A, Layer B, and the symmetric difference result into a single GeoJSON FeatureCollection, tagging each feature with which layer it came from.
  • GeoJSON format: Output files are standard RFC 7946 GeoJSON, which opens directly in QGIS, ArcGIS, Google Earth, Mapbox, and virtually every other GIS tool.

Because the output is plain GeoJSON, it re-imports cleanly into this same tool later, or into any GeoJSON or Shapefile workflow you run afterward in desktop GIS software.

Step-by-Step: Finding a Symmetric Difference

Empty Symmetric Difference Tool map with no basemap loaded, showing the draw, upload and sample polygon buttons before any layer is added
1
Step 1: Open the tool and add your first layer
The empty tool starts with no basemap: draw a polygon, upload a file, or click Sample Polygons.
Two overlapping sample polygon layers shown on a plain background with no basemap, with the layer list visible in the sidebar
2
Step 2: Add a second overlapping layer
Two layers loaded, still with no basemap. Layer A and Layer B are already picked for you.
Sidebar close-up showing the Layer A and Layer B dropdown selectors and the Find Symmetric Difference button
3
Step 3: Pick Layer A and Layer B
Confirm Layer A and Layer B, then click Find Symmetric Difference to run the overlay.
The computed symmetric difference shown as two separate highlighted shapes on the map with a total area readout in the sidebar, basemap now switched on
4
Step 4: Review the non-overlapping result
The result: the exact non-overlapping areas, plus their combined size. A basemap has been switched on here for context.
Layer manager panel listing Layer A, Layer B and the symmetric difference layer with export and download controls
5
Step 5: Export the result layer
Export the result alone, or all three layers together, as GeoJSON.

The GIS Libraries Behind Symmetric Difference

Symmetric difference is common enough that most GIS software ships it as a single named tool, even though under the hood it's almost always built from the same union and difference primitives this page just described.

  • Turf.js (difference + union): This tool's own engine. Turf.js has no single symmetricDifference function, so this tool calls @turf/difference twice and @turf/union for dissolving multi-feature layers, all running as pure JavaScript directly in your browser tab.
  • PostGIS ST_SymDifference: PostgreSQL's spatial extension ships ST_SymDifference as a single SQL function, backed by the GEOS library, the same C++ engine that computes ST_Intersection and ST_Difference.
  • QGIS Symmetrical Difference: QGIS's Processing Toolbox has a dedicated "Symmetrical Difference" algorithm under Vector Overlay, which also calls GEOS underneath the user interface.
  • ArcGIS Symmetrical Difference: Esri's ArcGIS Pro ships a Symmetrical Difference geoprocessing tool with the same input-two-layers, get-the-XOR behaviour, implemented with Esri's own geometry engine rather than GEOS.
  • Shapely (symmetric_difference): Python's Shapely library exposes a .symmetric_difference() method directly on its geometry objects, which, like everything else in Shapely, delegates to GEOS underneath.

All five tools agree on the same underlying mathematics, since symmetric difference has exactly one correct answer for a given pair of geometries. The practical difference, as with this site's other overlay tools, is where the computation runs: GEOS-based tools need PostgreSQL, QGIS or a Python environment installed, while this tool's Turf.js engine runs as a map polygon XOR finder directly on your device, so no file is ever uploaded anywhere.

Managing Multiple Layers

The sidebar layer manager keeps every polygon layer you add, plus every symmetric difference result you generate, in one list. You can run the tool more than once with different layer pairs, keep every result on the map at the same time, and delete any layer you no longer need without affecting the others, useful when checking how several candidate boundaries all differ from one base layer in turn.

Advertisement
Advertisement

Styling Your Layers

Every layer, including the result, can be restyled independently, and the basemap itself is entirely optional:

  • Color picker: Click the color swatch next to any layer in the sidebar to change its fill and outline color instantly.
  • Visibility toggle: Uncheck a layer to hide it on the map without deleting it, useful when comparing Layer A and Layer B against the result on their own.
  • Basemap toggle: The map loads with no basemap by default so the tool stays fast and the focus stays on your shapes. Check "Show basemap" in the sidebar at any point to add a Street or Satellite basemap underneath your layers, and switch it off again just as easily.

None of this styling is saved anywhere outside your session, it only controls how the map looks while you work.

Advertisement
Advertisement

Related Geoprocessing Tools

Map tiles © OpenStreetMap contributors and Protomaps (hosted by KONAKTIVE), CARTO, Esri (satellite, opt-in). Symmetric difference math powered by Turf.js. Shapefile parsing by shpjs. Map rendering by Leaflet. All drawing, file reading and calculation is local, no data is uploaded to any server.

Muhammad Gulraiz Khan, GIS Expert and Founder of KONAKTIVE and OnlineMapMaker.com

About the Author

Muhammad Gulraiz Khan

GIS Expert & Consultant · Founder, KONAKTIVE

Muhammad Gulraiz Khan is a GIS expert with over a decade of professional experience delivering geospatial solutions for the energy sector, including projects for the World Bank, the International Finance Corporation (IFC), and USAID. He built OnlineMapMaker.com to make professional-grade mapping tools free and accessible to everyone.

Advertisement
Advertisement