What Is a Polygon Difference, and Why You Need One
A polygon difference, also called an erase or a spatial subtract, takes two overlapping shapes and gives you back only the part of the first shape that is not covered by the second one. This is one of the most common tasks in GIS work: taking a protected zone out of a land parcel, removing a no-build buffer from a project site, or finding the part of one delivery zone that another store does not already cover.
How the Difference Is Worked Out
You pick two layers: an Input Layer (the shape you want to keep) and an Erase Layer (the shape you want to subtract). The tool looks at every polygon in the Input Layer and cuts away any part that falls inside the Erase Layer. What is left over becomes a brand new layer, so your original two layers stay untouched and ready to use again.
Only Polygons Work Here
This tool only accepts closed shapes: Polygon and MultiPolygon. Points and lines do not have an inside area, so a difference cannot be worked out for them. If your file has other shapes mixed in with polygons, the tool keeps only the polygons and tells you how many other shapes it did not use.
Two Ways to Add Your Polygons
Add the polygons you want to work with using one of these methods, or use both together in the same session:
- Draw on the map: Click "Draw Polygon", then click the map to add each corner. Finish the shape with a double-click, the Enter key, or the "Finish" button. Draw at least two overlapping polygons so the difference has something to remove.
- Upload a file: Click "Upload" or drag a file onto the map — a GeoJSON/.json file, or a zipped Shapefile (.zip with .shp, .dbf and .shx inside). Each file becomes its own layer.
No file ready? Click "Sample Polygons" to add two overlapping test shapes right away. Once you have at least two polygon layers, pick one as the Input Layer, pick another as the Erase Layer, choose a result color, and click "Run Difference".
Layer Colors and Result Style
Two color settings help you tell layers apart on the map:
- Layer color: each polygon layer gets its own color when you add it. You can change this color any time from the layer row.
- Result Color: sets the color of the new difference layer before you click "Run Difference". Change it again after, from the layer row, if you want a different look.
The new difference layer is drawn with a bolder outline and a stronger fill than the source layers, so the result always stands out on the map.
Working with Your Layers
Each polygon layer and each difference layer you make shows up as one row in the Layers list. From that row, you can turn the layer on or off, change its color, zoom the map to it, save it as GeoJSON, or delete it. None of these actions change any other layer. A difference result can even be picked again as an Input Layer or an Erase Layer for a next run, so you can chain several cuts together.
Saving Your Difference Result
Two ways to save your work are always ready in the sidebar:
- Save one layer: click the download icon next to any layer row to save only that layer as a GeoJSON file.
- Download All Layers: puts every layer on the map — inputs, erase layers, and difference results together — into one GeoJSON file, with each feature marked with its layer name.
GeoJSON opens without problems in Leaflet, Mapbox GL JS, QGIS and ArcGIS, and it even shows as a live map on GitHub.
Step by Step
Real-World Use Cases
Common Questions
More Tools You Might Like
Map tiles © OpenStreetMap contributors and CARTO, Esri (satellite). Difference math powered by Turf.js. Shapefile parsing by shpjs. Map rendering by Leaflet. All drawing, file reading and difference calculation is local — no data is uploaded to any server.