OnlineMapMaker logo

Polygon Difference Tool — Erase One Polygon From Another

Draw two polygons on the map, or upload a GeoJSON file or a zipped Shapefile, then subtract one polygon from another and keep only the area that is left. Pick a color for the result and save it as a GeoJSON file — fast, in your browser, with no extra program needed. Open in full screen ↗

Rate this tool:
Advertisement
Loading map…

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.

Advertisement

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.

Advertisement

Step by Step

1
Step 1
Open the tool
The map opens on a world view with no layers yet. The toolbar at the top has Draw Polygon, Upload, Sample Polygons and a basemap switch. The sidebar has the difference tool, the layer list, and the export button.
2
Step 2
Add your first polygon
Click "Draw Polygon" and click the map for each corner, or upload a GeoJSON file or a zipped Shapefile. This becomes your Input Layer — the area you want to keep.
3
Step 3
Add a second, overlapping polygon
Draw or upload a second shape that overlaps the first one. This becomes your Erase Layer — the area you want to cut out. Or click "Sample Polygons" to add two ready-made overlapping shapes.
4
Step 4
Pick the Input Layer
Open the "Input Layer" list in the sidebar and pick the layer whose area you want to keep.
5
Step 5
Pick the Erase Layer
Open the "Erase Layer" list and pick the layer you want to subtract from the Input Layer.
6
Step 6
Choose a result color
Click the color box next to "Result Color" and pick a color for the new difference layer.
7
Step 7
Click Run Difference
The tool cuts the Erase Layer out of the Input Layer and adds a new layer with only the area that is left. The map zooms to fit the new shape.
8
Step 8
Check and manage your layers
In the Layers list, turn any layer on or off, change its color, zoom to it, or delete it. Difference layers are marked differently from source polygon layers, so you always know which is which.
9
Step 9
Save your results
Click the download icon on a layer row to save just that layer, or click "Download All Layers" to save every layer — inputs, erase shapes, and results — in one GeoJSON file.

Real-World Use Cases

📐
Land Parcels and Easements
Land surveyors and title companies subtract a utility easement or a right-of-way strip from a full land parcel to see the true buildable area that is left for an owner.
🏙️
Urban Planning and Zoning
City planners remove a park, a flood zone, or a protected heritage area from a district polygon to find out how much of the district is actually open for new development.
📡
Telecom Coverage Analysis
Network engineers erase the coverage circle of a nearby tower from a new tower's coverage area, to see the extra, non-overlapping ground the new tower would actually add.
🚜
Farm Field Management
Precision farming teams subtract a flooded patch, a rocky corner, or an access road from a field boundary to work out the true plantable acreage for seeding and yield planning.
🌿
Environmental and Conservation Planning
Conservation groups subtract a protected wetland or reserve boundary from a proposed project site to show planners exactly which part of the site is still open for construction.
🚚
Retail and Delivery Zone Planning
Retail chains erase one store's delivery zone from a neighboring store's zone to define an exclusive service area with no overlap between the two locations.
Advertisement

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.

Advertisement