[GIS] Problems with intersecting two polygons layers in QGIS

intersectionqgis

I have two polygons layers, and I'm looking to find the % Area of layer A polygons that are placed inside layer B polygons. (some of them are totally inside ,so I expect to get the result "1", and some of them are half in and half in other polygon, so I expect to get "0.5" for both polygons of layer B)

When i'm using the Intersection tool (Vector->Geoprocessing tools), I get the following error: "Input layer A contains invalid geometries (Feature 1426). Unable to complete intersection algorithm."

When I try to use the "Join Attributes by Location" tool (Vector->Data Management Tool),using "Intersects" Geometric Predicate, I get a table with all layers A that intersect layer B, that's great but I can't calculate the % area of layer A polygons that are inside layer B polygons.

I'm using QGIS 2.18.4. Both layers are CRS EPSG:4326, WGS 84.
Any advice?

Best Answer

  1. Make sure all polygons on layers A and B have unique IDs (e.g. A1, A2, ..., B1, ...) so that you can easily identify the output.
  2. Run Vector | Geoprocessing Tools | Union which returns Union layer
  3. Open attribute table of Union. Each row corresponds to A~B combination.
  4. Open Field Calculator and calculate AREA by $area.
  5. Export Union attribute table as CSV.
  6. Separately, calculate AREA ($area) of original polygons on layer A.
  7. Use Excel or any spreadsheet software to find % area by (Union polygon) / (original polygon) * 100

enter image description here

Your AREA is calculated on EPSG:4326 and may not be accurate enough, but the ratio (%) would be okay.

Related Question