Calculate areas of overlapping polygons from two shapefiles

In Why does intersect not calculate polygon areas? the answer is "The area values in attribute table are just random attributes in the eyes of QGIS. It is therefore perfectly normal that these attribute values are not manipulated when running Intersect.

Intersect is provided by ftools plugin (a Python plugin). You can expand the tool's code to calculate the area of the resulting intersecting areas."

What would be the "code to calculate the intersections' areas" and to export them? It would be ingenious to do all tasks in ONE tool.

If you need to do it in one tool in QGIS, you can use Virtual Layer.

(1) From QGIS main menu, Layer | Add Layer | Add/Edit Virtual Layer.

(2) Click on [Import] button and select your two polygon layers (I assume poly1 and poly2 layers here).

(3) Give a query:

SELECT st_area(st_intersection(poly1.geometry, poly2.geometry)) AS area_m2
FROM poly1, poly2

It will add a virtual layer in your layer panel. If you open its attribute, it will be: If it is the first time, I would recommend to start doing it manually. (as already answered by @gene).

(1) From menu, start Vector | Geoprocessing Tools | Intersection

(2) Select one of your layer as Input layer, and the other as Intersect layer. Then Run. A new layer Intersection is created. (3) Open attribute table of Intersection layer, and start Field calculator. Create a new field by \$area expression. The output will look like below image: 1) object.intersects(other) is a topological binary predicate (yes or no) which has a spatial counterpart that returns a new geometric object object.intersection(other) whatever the units of the objects (meters, degrees, etc.) and their projection 2) The area of a polygon is the amount of space inside the polygon and depends on the units of the objects and their projection (different results) .

3) Therefore, it is easy to calculate the area after using the topological predicate with the command \$area in the field calculator • HI, thanks. I understand the principle, but I don't get QGIS to calculate this for me. Then I found the comment above, and wondered how to write this python. I am an R person myself, so don't know how to write the code in python, particular since I have more than just 2 overlapping polygons. – user2006697 May 13 '16 at 8:33

I am not that expert in QGIS, but I think you can quite easily accomplish your task first converting your polygons to raster, and then using a bit of Map Algebra. You can calculate the percentage of overlap by using the Jaccard coefficient. This coefficient is equal to: the INTERSECTION between the two rasters divided by the UNION between the two rasters. The details are provided here: https://www.researchgate.net/post/How_to_statistically_compare_two_maps. That is tailored for ArcGIS but I think can be easily adapted to QGIS. Once you know the percentage of overlap, and given the total area (i.e., the sum of the polygons' area), you can derive the actual area of the overlapping zone.