I am trying to compare two different vector layers on QGIS 3. They are species distribution maps.

I would like to calculate the percentage of overlap of two vector layers. My goal is to determine how similar the two ranges are.

Anyone know how I can do this in QGIS 3.8?

  • 1
    Welcome to GIS SE. As a new user, please take the Tour, which explains how our Focused question/Best answer model operates. In addition to a goal, an explanation of how you attempted to solve the task is expected, along with a detailed description of the problem encountered. In ArcGIS, overlap in vector layers usually requires a Union and some summary statistics; I suggest you research the overlay tools available in your release of QGIS.
    – Vince
    Oct 27, 2019 at 17:17
  • Please, do not forget about "What should I do when someone answers my question?"
    – Taras
    Oct 14, 2021 at 9:10

3 Answers 3


Since QGIS 3.8, it's now included in QGIS core, without plugin or coding.

In the Processing Toolbox, search for Overlap and open the Overlap analysis:

enter image description here

Source: http://changelog.qgis.org/en/qgis/version/3.8/#overlap-analysis

  • 1
    This is a useful tool, and should be added as a default to the Vector > Geoprocessing Tools... menu. In regards to the OP, however, the percent overlap of both layers was requested (if I understand the OP correctly...). I could not find a way to answer that with the Overlap tool because it only calculates the percent overlap of one layer against another. Did I miss something?
    – Stu Smith
    Oct 28, 2019 at 15:27
  • @StuSmith Can't you run the algorithm a second time by switching layers?
    – etrimaille
    Oct 28, 2019 at 15:51
  • 1
    I don't think so. Consider two layers, A and B. Running the tool twice and switching layers would give you 1) the percentage of A that is overlapped by B and 2) the percentage of B that is overlapped by A. But, the OP is requesting the percent overlap of A + B. I couldn't find a way for the Overlap tool to accomplish that.
    – Stu Smith
    Oct 28, 2019 at 16:21
  • This tool looks perfect as I am looking for the area of overlap and percentage of the input feature overlapped by each of the selected overlay layers. Where do I find this percentage and area values? It says they are new attributes to the output layer. How do I find where the percentage and area values - where are they reported?
    – JS5687
    Nov 13, 2019 at 3:09
  • I'm not sure why, but when I tried to use this tool it gave me a number of values above 100% overlap; which shouldn't be possible. Is this a common issue? I am working on the assumption to get a %, you divide the 'pc' column output by 100
    – mimiasmith
    Oct 12, 2021 at 7:41

Using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer....

Let's assume there are two overlapping polygon layers called 'LayerA' (brown) and 'LayerB' (grey), see image below.


With the following query, it is possible to calculate the percentage of overlap of two layers.

        st_union(A.geometry, B.geometry) AS geom1
        "layerA" AS A,
        "layerB" AS B

InterAB AS (
        st_intersection(A.geometry, B.geometry) AS geom2
        "layerA" AS A,
        "layerB" AS B

    round(st_area(geom1),2) AS "union_area",
    round(st_area(geom2),2) AS "inter_area",
    round(round(st_area(geom2),2)/round(st_area(geom1),2)*100,2) AS "overlapping%" 


  • geom1 is the geometry of union of two layers
  • geom2 is the geometry of the intersection of two layers

For more details regarding geometries comparison, please check this article Understanding Join Attributes by Location in QGIS?.

The output Virtual Layer will provide the answer in the following attribute table


Note: the geometry is not included

Where to paste the code is described in Creating dummy variables between layers based on their geometries in QGIS, under the Answering the question in comments: "Where/How can I enter the code?".


Welcome to GIS SE, JS5687!

If, like me, you are unfamiliar with coding - such as the answer provided by @Taras - here's an old-school GIS analysis process. For my example, I have two layers named triangle and circle, both in the same CRS:

enter image description here

  1. I added two numeric attribute fields to triangle: exist_tri (calculated to the number 1) and area_tri (calculated to $area, which results in the area in square feet - or whatever unit of measure is appropriate for the CRS):

enter image description here

  1. I added two numeric attribute fields to circle: exist_cir (calculated to the number 1) and area_cir (calculated to $area, which results in the area in square feet - or whatever unit of measure is appropriate for the CRS):

enter image description here

Then I ran the Vector > Geoprocessing Tools > Union... tool, with the Input Layer = triangle and the Overlay Layer = circle. Note that in this case, it doesn't matter which layer is the Input or the Overlay.

Here's the result from the Union. Note that there are three records, one for each output polygon. Note also that the four attribute fields that I earlier added (two for triangle and two for circle) are all present in the output table. Furthermore, those fields contain their original values.

enter image description here

I then added a new numeric attribute field to the output layer, area_union, and calculated it to $area. This generates the area for each of the three output polygons.

Next, I added three additional numeric attribute fields to the output layer: pct_tri, pct_cir, and pct_tri_cir, calculating each to NULL.

Below is the final product. Note that overlap(s) always occur where exist_tri = 1 and exist_cir = 1, which is what I have selected. Following the selection, I apply these formulas, using the field calculator:

pct_tri = ("area_union" / "area_tri") * 100
- this is the proportion of triangle that is covered by the overlap(s)

pct_cir = ("area_union" / "area_cir") * 100
- this is the proportion of circle that is covered by the overlap(s)

pct_tri_cir = ("area_union" / ("area_tri" + "area_cir" - "area_union")) * 100
- this is the proportion of the outer boundary of triangle and circle that is covered by the overlap(s)
- If I understand your question correctly, this is the value that will be of interest to you; pct_tri and pct_cir are included in case other readers have different needs.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.