OnlineMapMaker logo

GIS Erase Tool: Remove Features Inside Another Layer

Cut away every part of a point, line or polygon layer that falls inside a set of erase polygons. The input attributes stay, and you can download the result as GeoJSON, KML or CSV. It works like Erase in ArcGIS Pro and Difference in QGIS, runs in your browser, and uploads nothing. Open fullscreen version →

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

What the erase tool does

Erase is the opposite of Clip. You give it two layers. The first one is the input layer: the data you want to keep, for example land parcels, roads or buildings. The second one is the erase layer: polygons that mark areas you want to remove, for example flood zones, protected areas or a lake. The tool cuts the erase polygons out of the input. Everything outside them stays. Everything inside them is removed.

The output has the same geometry type as the input. A road that runs through a flood zone is cut at the edge of the zone, and only the dry pieces stay. A parcel that is half inside the zone keeps only its dry half. A bus stop inside the zone disappears. The attribute table of the input is copied to the output unchanged, so every parcel keeps its ID, owner and land use. The erase layer gives only its shape, and its attributes are not added. ArcGIS Pro (Erase and Pairwise Erase) and QGIS (Difference) follow the same rule.

I built this tool because "remove everything inside these areas" is one of the most common GIS questions, and it should not need a desktop GIS and an advanced licence. Drop a zipped Shapefile, GeoJSON, KML, KMZ, GPX or WKT file on the map, or draw your own shapes and erase rectangles. Pick the input and the erase layer, click Erase, and download the result. All the geometry math runs in your browser, so your files stay on your computer. The map starts without a basemap, which keeps it fast. You can turn on a street or satellite basemap at any time.

Advertisement
Advertisement

Erase, Clip, Intersect and Difference: which one do you need?

These four overlay tools are easy to mix up, because they all use one layer to cut another. The difference is which part they keep and which attributes they carry. This table puts them side by side for an input layer A and an overlay layer B.

ToolKeepsAttributes in the output
Erase (this tool)The parts of A outside BOnly those of A
ClipThe parts of A inside BOnly those of A
IntersectThe parts of A inside BThose of A and B together
Symmetric DifferenceThe parts of A outside B, and the parts of B outside AThose of A and B
Polygon Difference (this site)One polygon minus another polygonMade for two drawn or uploaded polygons, not for a whole data layer

A quick test: if you run Clip and Erase on the same input with the same overlay, the two outputs together give back the original input. Clip keeps the inside, Erase keeps the outside, and nothing is lost or counted twice.

Supported file formats

You can load several files at once, and you can mix formats. Each file becomes its own layer in the Layers panel. A layer can hold points, lines and polygons together, and each of them is erased with the right method.

Input formats (what you can upload)

FormatExtensionNotes
GeoJSON.geojson, .jsonA FeatureCollection, a single Feature or a bare geometry. A GeometryCollection is split into its parts.
Esri Shapefile.zipZip the .shp, .shx and .dbf files together. Add the .prj file and projected data is converted to WGS84 when it loads. A .cpg file sets the text encoding.
KML.kmlGoogle Earth placemarks. MultiGeometry is split into its parts, and ExtendedData becomes attributes.
KMZ.kmzA zipped KML file. The first .kml file inside the archive is read.
GPX.gpxGPS files. Waypoints become points, and tracks and routes become lines. Elevation values are kept.
WKT.wkt, .txtWell-Known Text. One geometry for the whole file, or one geometry per line.

Output formats (what you can download)

FormatExtensionNotes
GeoJSON.geojsonThe standard web format (RFC 7946) in WGS84. Keeps every attribute. Opens in ArcGIS Pro, QGIS and almost every web map library.
KML.kmlOpens in Google Earth. Attributes are written as ExtendedData on each placemark.
CSV (WKT).csvOne row per feature. The first column holds the geometry as WKT, and each attribute gets its own column. Opens in Excel, and QGIS can read the WKT column as geometry.

Each file can be up to 50 MB. For very large national datasets, a desktop GIS is still the better choice. See the comparison further down this page.

Technical details

Here is exactly what the tool does with your data. If you know Erase in ArcGIS Pro or Difference in QGIS, most of this will look familiar.

Input geometry types
Point, MultiPoint, LineString, MultiLineString, Polygon and MultiPolygon. One layer can mix all of them.
Erase geometry types
Polygon and MultiPolygon, with or without holes. A layer without polygons cannot be picked as the erase layer.
Several erase polygons
All polygons of the erase layer are merged (dissolved) into one mask before erasing. Where erase polygons overlap, the area is still removed only once.
Holes in the erase layer
A hole in an erase polygon is not part of the erase area. Features inside the hole stay. For example, an island inside an erased lake is kept.
Attributes
Every attribute of the input feature is copied unchanged. Attributes of the erase layer are not added. As an option, the tool adds erase_status (outside or erased) and erase_area_m2, erase_length_m or erase_points for what is left.
Coordinate system
WGS84 longitude and latitude (EPSG:4326), the same as GeoJSON. A zipped Shapefile with a .prj file is converted to WGS84 when it loads.
Geometry model
Cutting is done on a flat plane in degrees, the same model that Turf.js and most web GIS libraries use. Areas and lengths in the results panel are measured on the sphere (geodesic), in square metres and metres.
Boundary rule
The edge of an erase polygon counts as part of the erase area. A point that lies exactly on the edge is erased, and so is a line piece that runs along the edge. This makes Erase the exact opposite of the Clip Tool on this site, which keeps those features.
Elevation (Z)
Existing Z values stay on their vertices. A new vertex created where a line is cut gets a Z value interpolated between its two neighbours.
Multipart output
If an erase cuts a feature into several pieces, the pieces stay together as one multipart feature (MultiLineString, MultiPolygon or MultiPoint), as in ArcGIS Pro. Tick "Split multipart results" to get one feature per piece.
Invalid geometry
If one input feature has broken geometry (for example a self-crossing polygon), that feature is skipped and counted, and the rest of the layer is still erased.
Privacy
Everything runs in your browser. No file and no geometry is sent to a server.

How to use the erase tool, step by step

Here is the whole workflow with the built-in sample data: a city layer with parcels, roads and points, and three flood-zone polygons to erase from it. Your own files work the same way.

Empty GIS Erase Tool map without a basemap, showing the drawing tools, the Upload button and the Sample Data button
1
Step 1: Open the tool

The map opens empty and without a basemap, so nothing loads that you do not need. The toolbar has Point, Line, Polygon and Erase Rectangle drawing tools, an Upload button and a Sample Data button.

Sample city layer with parcels, roads and points, and blue flood-zone polygons across the middle of the city, on a blank map
2
Step 2: Add an input layer and an erase layer

Drag and drop your files onto the map, or click Upload. Here I clicked Sample Data. It adds a city layer with parcels, roads and points, and a flood-zone layer with a floodway, a retention basin and a spillway that overlap each other.

Erase panel with the input layer and the erase layer selected, and the two option checkboxes
3
Step 3: Pick the layers and options

In the Erase panel, choose the input layer (the data to keep) and the erase layer (the areas to remove). Only layers with polygons appear in the erase list. Choose whether you want the extra erase_status, area and length fields, and whether multipart results should be split.

Erase result on the map: parcels, roads and points with the flood zones cut out, and the results summary in the sidebar
4
Step 4: Click Erase Layer

The result appears as a new layer in solid color, and the input layer is hidden. The flood zones are now empty gaps in the city. The results box shows how many features were untouched, partly erased or fully erased, and the area, length and points that are left and that were removed.

Erased layer over satellite imagery with a popup showing the attributes of one cut parcel
5
Step 5: Check the result with a basemap and the attributes

Tick "Show basemap" to see the result on a street or satellite map. Click any feature to open its attributes. The original fields are all there, plus the optional erase fields.

Export panel with the erased layer selected and the GeoJSON, KML and CSV download buttons
6
Step 6: Download the erased layer

In the Export panel, pick the layer and download it as GeoJSON, KML or CSV with a WKT column. The small arrow next to each layer in the Layers panel is a quick GeoJSON download.

Advertisement
Advertisement

How to erase features in a GIS

Every GIS has this tool, but the name changes. ArcGIS calls it Erase, QGIS calls it Difference, and PostGIS and GeoPandas call the function difference. Here is how to run it in this tool, in ArcGIS Pro, in ArcMap and in QGIS, and how to script it.

In this tool

Load the layer you want to keep and the polygons you want to remove. Choose the first as the input layer and the second as the erase layer, then click Erase Layer. If you only need to remove a rectangular area, click Erase Rectangle and click two opposite corners on the map. The rectangle becomes the erase layer at once. Points, lines and polygons in the same input layer are all erased in one run.

In ArcGIS Pro

Open the Geoprocessing pane and search for Erase. You will find two tools. Pairwise Erase (Analysis toolbox > Pairwise Overlay) works at every licence level and uses parallel processing, so it is usually the faster choice. Erase (Analysis toolbox > Overlay) is the classic tool. It has long needed an Advanced licence, so check the tool page for your version. Set Input Features and Erase Features, choose an output and click Run. Both keep only the attributes of the input.

In ArcMap

In ArcMap the tool is in ArcToolbox > Analysis Tools > Overlay > Erase, and it needs an Advanced (ArcInfo) licence. The parameters are the same as in ArcGIS Pro. Esri retired ArcMap in March 2026, so for new work I recommend ArcGIS Pro, QGIS or this tool. Old scripts that call Erase_analysis move to ArcGIS Pro with small changes, and PairwiseErase is a good replacement.

In QGIS

Go to Vector > Geoprocessing Tools > Difference. Choose the Input layer (the data to keep) and the Overlay layer (the polygons to remove), then click Run. The result is a temporary layer, which you can save as a GeoPackage or Shapefile. The name confuses many people who come from ArcGIS: QGIS Difference is the same operation as ArcGIS Erase.

With arcpy (Python for ArcGIS)

In ArcGIS Pro the functions are arcpy.analysis.PairwiseErase(in_features, erase_features, out_feature_class) and arcpy.analysis.Erase(...) with the same parameters. Old ArcMap scripts use arcpy.Erase_analysis. An optional fourth parameter sets the XY tolerance. The code below shows these forms, plus the same job in PyQGIS, GeoPandas and PostGIS.

The same erase in code

If you remove the same zones every week, a script saves time. All these examples remove flood zones from a parcels layer.

import arcpy

arcpy.env.workspace = r"C:\data\city.gdb"

# ArcGIS Pro: Analysis toolbox > Pairwise Overlay > Pairwise Erase
arcpy.analysis.PairwiseErase("parcels", "flood_zones", "parcels_dry")

# ArcGIS Pro: Analysis toolbox > Overlay > Erase
arcpy.analysis.Erase("parcels", "flood_zones", "parcels_dry")

# Older ArcMap syntax (same tool, old name)
arcpy.Erase_analysis("parcels", "flood_zones", "parcels_dry")
# QGIS Python console: Vector > Geoprocessing Tools > Difference
processing.run("native:difference", {
    "INPUT": "C:/data/parcels.shp",
    "OVERLAY": "C:/data/flood_zones.shp",
    "OUTPUT": "C:/data/parcels_dry.gpkg",
})
# GeoPandas (works for points, lines and polygons)
import geopandas as gpd
parcels = gpd.read_file("parcels.shp")
flood = gpd.read_file("flood_zones.shp").to_crs(parcels.crs)

parcels_dry = parcels.copy()
parcels_dry.geometry = parcels.geometry.difference(flood.union_all())
parcels_dry = parcels_dry[~parcels_dry.is_empty]

-- PostGIS
SELECT p.*, ST_Difference(p.geom, f.geom) AS geom_dry
FROM parcels p
CROSS JOIN (SELECT ST_Union(geom) AS geom FROM flood_zones) f
WHERE NOT ST_IsEmpty(ST_Difference(p.geom, f.geom));

My take: for one erase on a normal-sized file, this tool is the fastest way from file to result. In ArcGIS Pro, reach for Pairwise Erase first. For jobs that repeat, write the script once and reuse it.

How the tool works, step by step

This is the path your data takes from the moment you click Erase Layer. Every step runs in your browser.

  1. Read and clean the input. Every file is turned into GeoJSON features in WGS84. A GeometryCollection is split into separate features with the same attributes, so the engine only sees simple geometry types.
  2. Dissolve the erase layer. All polygons of the erase layer are merged into one geometry, the mask M, with a polygon union. Holes stay holes. Overlapping erase polygons become one shape, so an area that two zones cover is removed only once.
  3. Quick bounding box test. The tool compares the bounding box of each input feature with the bounding box of M. If the two boxes do not touch, the feature cannot lose anything, so it is copied to the output at once without any detailed math. This is the reverse of Clip, where such features are dropped.
  4. Erase points. Each point is tested with a point-in-polygon test against M. Points strictly outside M are kept. Points inside or on the edge are removed. For a MultiPoint, only the outside points stay.
  5. Erase lines. Each line segment is tested against every edge of M that is near it. The tool finds every place where the segment crosses an edge and cuts it there. Then it tests the middle of each small piece. If the middle is outside M, the piece is kept. Pieces that touch each other are joined again into one line.
  6. Erase polygons. Each polygon is reduced by M with a sweep-line boolean difference (Martinez-Rueda). The result can have new holes where an erase polygon sat fully inside a parcel, or several parts where an erase polygon cut it in two.
  7. Copy attributes and add fields. Each output feature gets a copy of all attributes from its input feature. If you asked for it, the tool adds erase_status and the area, length or point count that is left. If you ticked the multipart option, multipart results are split into single parts here.
  8. Report and draw. The tool counts untouched, partly erased, fully erased and skipped features, adds up the area, length and points that are left and that were removed, and draws the result as a new layer. The input layer is hidden so you can see the result clearly.

The code for lines is shared with the Clip Tool on this site, with one switch turned the other way: Clip keeps the pieces whose middle is inside the mask, and Erase keeps the pieces whose middle is outside. That is why the two tools always fit together without gaps or overlaps.

The theory and math behind erasing

Erase is set difference applied to geometry. Here is the math, from the set rule to the algorithms and the measurements.

1. Erase as a set difference

In set theory, erasing is a difference. Each input feature a is replaced by the part of it that is not in the mask M. A feature that lies fully inside M becomes empty and disappears. The mask is the union of all erase polygons.

Erase(A, M) = { a \ M  :  a ∈ A  and  a \ M ≠ ∅ }

a \ M = { p ∈ a  :  p ∉ M }

M = M₁ ∪ M₂ ∪ … ∪ Mₖ     (all erase polygons, merged first)

Merging first does not change the answer, because removing several areas one after another is the same as removing their union once: a \ (M₁ ∪ M₂) = (a \ M₁) \ M₂. It only makes the work faster and stops an overlap from being processed twice.

2. Erase and Clip split a feature into two parts

Clip and Erase cut every feature into two pieces that do not overlap and that together make the whole feature. For polygons, the areas add up exactly. For lines, the lengths add up.

a = (a ∩ M) ∪ (a \ M)        Clip part + Erase part
(a ∩ M) ∩ (a \ M) = ∅        no overlap

area(a) = area(a ∩ M) + area(a \ M)

This is a useful check on any result. In this tool, the results box shows the area that is left and the area that was erased. Together they should equal the area of the input polygons. If they do not, an input polygon was probably invalid and was skipped.

3. Point in polygon: the ray casting rule

To decide if a point is inside the mask, draw a ray from the point to the right and count how many times it crosses the mask boundary. An odd count means inside, an even count means outside. Holes need no special case: their edges are counted like any other edge, which is why a point in a hole counts as outside and is kept.

Point P = (x, y). Edge from (xi, yi) to (xj, yj).

The edge is crossed when:
  (yi > y) ≠ (yj > y)
  and  x < xi + (y − yi) · (xj − xi) / (yj − yi)

P is inside  ⇔  the number of crossed edges is odd
Erase keeps P  ⇔  P is not inside and not on an edge

4. A worked example

Take a road from (−5, 5) to (15, 5), and a square erase polygon from 0 to 10 in both directions, with a square hole (an island) from 4 to 6. The road crosses four edges, at t = 0.25, 0.45, 0.55 and 0.75. The tool tests the middle of each piece.

Road:  p = (−5, 5)   q = (15, 5)   length 20

Piece (t)      Middle x   Test          Erase keeps
0.00 – 0.25    −2.5       outside       yes → (−5, 5) – (0, 5)
0.25 – 0.45     2.0       inside        no
0.45 – 0.55     5.0       in the hole   yes → (4, 5) – (6, 5)
0.55 – 0.75     8.0       inside        no
0.75 – 1.00    12.5       outside       yes → (10, 5) – (15, 5)

Erase result: MultiLineString, 3 pieces, 5 + 2 + 5 = 12 units
Clip result:  MultiLineString, 2 pieces, 4 + 4     =  8 units
12 + 8 = 20  (the whole road)

This is the exact case the tool's own tests check, together with points on the edge, points in the hole, overlapping erase polygons and Z values on new vertices.

5. Polygon difference with a sweep line

Polygon boolean operations have a long history in computer graphics. Sutherland and Hodgman (1974) could clip against a convex window. Weiler and Atherton (1977) handled concave shapes and holes. Vatti (1992) and Greiner and Hormann (1998) made the general case practical. GIS data needs that general case: any shape, with holes, many parts and edges that touch.

This tool uses polyclip-ts through Turf.js. It is based on the sweep-line algorithm of Martínez, Rueda and Feito (2009). An imaginary vertical line moves from left to right across both polygons and stops only at vertices and crossing points. At each stop, every edge is labelled as inside or outside the other polygon. For a difference, the result keeps the edges of the input that are outside the mask, plus the edges of the mask that are inside the input, with their direction reversed so they become the new boundary or a new hole. With n edges and k crossings the cost is about O((n + k) · log n).

6. Measuring what is left and what was removed

The results panel reports areas and lengths on the Earth's surface, not in degrees. Areas use the spherical ring formula from Chamberlain and Duquette (NASA JPL, 2007), which Turf.js uses. Lengths use the haversine formula. Both use the mean Earth radius R = 6,371,008.8 m.

Ring area (λ = longitude, φ = latitude, in radians):
A = (R² / 2) · | Σ (λ(i+1) − λ(i−1)) · sin φi |

Segment length (haversine):
h = sin²(Δφ / 2) + cos φ1 · cos φ2 · sin²(Δλ / 2)
d = 2R · asin(√h)

R = 6 371 008.8 m

A sphere is a close model of the Earth. For areas and lengths, the error is usually under 1 percent. That is fine for planning and for checking a result. For legal or survey-grade numbers, measure again in a local projected coordinate system.

Erase in this tool, ArcGIS Pro and QGIS compared

All three give the same geometry for normal data. They differ in cost, set-up and how much data they can handle. Here is a side-by-side view.

FeatureThis toolArcGIS ProQGIS
Name of the toolEraseErase and Pairwise EraseDifference
PriceFree, no accountPaid ArcGIS licence (classic Erase has long needed Advanced)Free and open source
InstallationNone, runs in the browserWindows desktop appDesktop app for Windows, macOS and Linux
Input formatsGeoJSON, Shapefile ZIP, KML, KMZ, GPX, WKTGeodatabases, shapefiles and many moreEverything GDAL/OGR can read
Erases points, lines and polygonsYes, even mixed in one layerYesYes
Attributes in outputInput attributes, plus optional erase fieldsInput attributesInput attributes
AutomationNone, one run at a timearcpy and ModelBuilderPyQGIS and the Graphical Modeler
Very large datasetsUp to 50 MB per fileYes, Pairwise Erase uses several CPU coresYes
Where your data goesStays in your browserStays on your computerStays on your computer

My recommendation: if your data lives in an ArcGIS geodatabase, use Pairwise Erase in ArcGIS Pro. It is fast, it works at every licence level, and arcpy lets you repeat the job. If you want a full desktop GIS at no cost, QGIS Difference does the same job and reads almost any format.

This tool wins when you need a result in a minute: someone sends you a zipped Shapefile of parcels and a KML of no-build zones, and you need the parcels that are left. You do not have to install anything, and nothing leaves your computer. It is also a clear way to learn how Erase behaves, because you see every cut on the map.

Advertisement
Advertisement

10 real-world use cases

Erase answers the question "what is left after we take these areas away?". These are the jobs I see most often.

  1. Buildable land after constraints. A developer starts with a parcel layer and erases flood zones, wetlands, protected areas and setback buffers. What is left is the land that can actually be built on, with every parcel ID and owner still attached.
  2. Flood risk screening. A planner erases the flood zone from a buildings or roads layer to get the assets that stay dry. Running Clip on the same data gives the assets at risk. Together the two outputs cover every asset once.
  3. Land cover without water. An analyst erases lakes and rivers from land-cover or soil polygons, so area statistics count only land. Islands inside the lakes are holes in the water layer, so they are kept automatically.
  4. Farm fields minus no-spray zones. An agronomist erases buffers around streams, wells and houses from the field boundaries. The result is the area that can be sprayed or fertilised, ready for the machine or the application plan.
  5. Wind and solar site search. Energy planners erase buffers around homes, airports, roads and protected habitats from a study area. The polygons that remain are candidate sites, and their area shows the possible capacity.
  6. Network outside an existing service area. A water or fibre company erases its current service area from the road network. The roads that remain show where new pipes or cable would be needed to reach the next customers.
  7. Habitat outside development. An ecologist erases planned development footprints from a habitat map. The result shows how much habitat would remain, and each remaining patch keeps its habitat type and condition score.
  8. Cleaning GPS tracks. A runner or researcher erases private areas, such as a home zone, from GPX tracks before sharing them. The rest of the track stays, with elevation kept on every point.
  9. Sampling outside excluded areas. Field scientists erase roads, buildings and water from a study area before placing random sample points. Every point then lands in a place that can actually be surveyed.
  10. Teaching overlay analysis. Teachers show Clip and Erase side by side with the same sample data. Students see that the two results fit together like puzzle pieces, which makes the idea of set difference easy to understand.

Frequently asked questions

Eighteen questions people ask about erasing in GIS, with direct answers.

1. What does the Erase tool do in GIS?

Erase removes the parts of an input layer that fall inside the polygons of an erase layer. It keeps everything outside them, and it keeps the attributes of the input features. You can think of it as a hole punch: the erase polygons are the holes, and the input layer is the paper.

2. What is the difference between Erase and Clip?

They are opposites. Clip keeps the parts of the input inside the overlay polygons. Erase keeps the parts outside them. If you run both on the same data, the two outputs together give back the original input, with no gaps and no overlaps.

3. Is QGIS Difference the same as ArcGIS Erase?

Yes. QGIS calls the operation Difference (Vector > Geoprocessing Tools > Difference), and ArcGIS calls it Erase. Both remove the overlay area from the input and keep only the input attributes. Do not mix it up with Symmetric Difference, which also keeps the parts of the overlay layer outside the input.

4. What is the difference between Erase and Pairwise Erase in ArcGIS Pro?

Both give the same result for normal data. Pairwise Erase uses parallel processing on several CPU cores, so it is usually faster on large data, and it works at every licence level. The classic Erase tool has long needed an Advanced licence. Check the tool page for the version you use.

5. Can I erase lines and points, or only polygons?

You can erase all three. Points inside the erase polygons are removed. Lines are cut at the edge, and only the outside pieces stay. Polygons lose the area they share with the erase polygons. One input layer can mix points, lines and polygons.

6. Which attributes does the erased layer keep?

Every attribute of the input feature is copied without changes. The attributes of the erase layer are not added. As an option, the tool adds erase_status (outside or erased) and the area in square metres, length in metres or number of points that is left.

7. What happens to a feature that is completely inside the erase area?

It is removed from the output. The results box counts these features as "fully erased". A feature that does not touch the erase area at all is copied unchanged and counted as "untouched".

8. Why does a polygon get a hole after erasing?

When an erase polygon sits fully inside an input polygon, the only way to remove it is to cut a hole. For example, erasing a pond from a park leaves the park with a hole where the pond was. This is correct, and GIS software reads such holes without problems.

9. Why did my feature turn into a Multi geometry?

When an erase polygon cuts a feature into more than one piece, for example a road crossing a river, the pieces stay together as one multipart feature, so the attributes are not duplicated. ArcGIS Pro does the same. Tick "Split multipart results into single parts" if you want one feature per piece.

10. What happens to features exactly on the erase boundary?

The edge counts as part of the erase area. A point exactly on the edge is removed, and so is a line piece that runs along the edge. A polygon that only touches the edge from outside loses no area, so it stays unchanged.

11. Can the erase layer have several overlapping polygons or holes?

Yes. All erase polygons are merged into one mask first, so an area covered by two polygons is removed only once. Holes are respected: anything inside a hole of an erase polygon, such as an island in a lake, stays in the output.

12. Which file formats can I upload and download?

You can upload GeoJSON, a zipped Esri Shapefile (with .shp, .shx and .dbf, plus .prj for projected data), KML, KMZ, GPX and WKT. You can download GeoJSON, KML and CSV with a WKT geometry column. GeoJSON is the best choice for ArcGIS Pro or QGIS, because it keeps the attribute types.

13. Is my data uploaded to a server?

No. Reading the files, erasing and writing the output all run in your browser. Your files never leave your computer. Only the optional basemap tiles come from the internet, and only after you turn the basemap on.

14. Can I erase projected data, such as UTM?

The tool works in WGS84 longitude and latitude (EPSG:4326). A zipped Shapefile in UTM or a national grid is converted to WGS84 when it loads, as long as its .prj file is inside the ZIP. GeoJSON should already be in WGS84, as the GeoJSON standard requires.

15. Nothing was erased. What went wrong?

The most common cause is that the two layers do not overlap. Turn on the basemap and zoom to each layer to check where they are. A Shapefile without its .prj file often lands in the wrong place. Also check that you picked the polygon layer as the erase layer, not as the input.

16. How do I erase in QGIS?

Go to Vector > Geoprocessing Tools > Difference, choose the Input layer and the Overlay layer, and click Run. In the Python console the same job is processing.run("native:difference", ...) with the INPUT, OVERLAY and OUTPUT parameters.

17. How do I erase with arcpy in a Python script?

In ArcGIS Pro, call arcpy.analysis.PairwiseErase("parcels", "flood_zones", "parcels_dry"), or arcpy.analysis.Erase(...) with the same parameters. The old ArcMap form is arcpy.Erase_analysis(...). A for loop over several layers or zones is where arcpy saves the most time.

18. Are the area and length numbers accurate?

They are measured on a sphere with a radius of 6,371,008.8 m, so they are in real square metres and metres, not degrees. The error against the true ellipsoid is usually under 1 percent. For legal or survey-grade values, measure again in a local projected coordinate system.

Libraries used and credits

This tool is built on open source software. Many thanks to the people who write and maintain these projects.

  • Leaflet 1.9 · BSD-2-Clause · Volodymyr Agafonkin and contributors
    Draws the interactive map, the layers, the drawing tools and the popups.
  • Polygon difference for erasing polygons, union for dissolving the erase layer, geodesic area, and the point-in-polygon test.
  • polyclip-ts · MIT · Luiz Felipe Machado Barboza, based on polygon-clipping by Mike Fogel
    The boolean polygon engine behind Turf's difference and union. It uses the Martinez-Rueda sweep-line algorithm with arbitrary-precision math.
  • point-in-polygon-hao · MIT · Rowan Winsemius
    The fast point-in-polygon test that decides which points and line pieces fall inside the erase area.
  • shpjs · MIT · Calvin Metcalf
    Reads zipped Esri Shapefiles (.shp, .shx, .dbf, .prj, .cpg) in the browser.
  • proj4js · MIT · proj4js contributors
    Converts projected Shapefiles to WGS84 using their .prj file (used by shpjs).
  • @tmcw/togeojson · BSD-2-Clause · Tom MacWright
    Converts KML and GPX files to GeoJSON.
  • JSZip · MIT or GPL-3.0 · Stuart Knightley
    Opens KMZ archives to read the KML file inside.
  • @terraformer/wkt · MIT · Terraformer contributors
    Reads WKT input and writes the WKT geometry column in the CSV export.
  • OpenStreetMap, Protomaps (hosted by KONAKTIVE), CARTO, Esri World Imagery · ODbL and provider terms · OpenStreetMap contributors, Protomaps, KONAKTIVE, CARTO, Esri
    Basemap tiles and imagery, shown only when you turn the basemap on.

The line cutting step (splitting segments at boundary crossings and testing each piece) was written for this site and is shared with the Clip Tool. The erase engine is checked by automated tests for lines through holes, points on the edge and in holes, polygons that become a frame around an island, overlapping erase polygons, Z interpolation, and the rule that Clip plus Erase gives back the whole input.

Related geoprocessing tools

All erasing runs in your browser. No file is ever uploaded to a server. Map tiles © OpenStreetMap contributors, drawn with Protomaps (hosted by KONAKTIVE), with CARTO as the fallback. Satellite imagery: Esri.

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