4

I calculated intersection between Layer 1 and Layer 2 using expression below:

area(
    intersection (
        $geometry, 
        collect_geometries(
            overlay_intersects ('layer1',$geometry)
        )
    )
)

And total area of polygon on Layer 2 using: $area

Given the fact that polygon drawn on Layer 2 is completely inside polygon from Layer 1 the area of intersection should equal the total area of polygon but for some reason that's not the case and I don't understand why and how to fix it.

Geometry situation

Attribute table

This question is a indirect follow-up to this thread: Calculating area of polygon intersection with condition

Scrchd
  • 155
  • 6
  • 4
    Probably one calculation was done using planimetric measuring, and the other took into account the ellipsoid. – Erik Jan 09 '23 at 08:03
  • So it has something to do with CRS or with the way both funtions are calculated? I made sure that both Layers and Project are using EPSG:2180, but that didn't do the trick. – Scrchd Jan 09 '23 at 08:07
  • 4
    Also check this: https://gis.stackexchange.com/a/348856/63384 for the difference between planimetric area area() and ellipsoidal area $area – ahmadhanb Jan 09 '23 at 08:18
  • 1
    and also this one of course : https://gis.stackexchange.com/questions/23355/calculating-polygon-areas-in-shapefile-using-qgis – Taras Jan 09 '23 at 08:21
  • @ahmadhanb This is what I was looking for, I should be using area($geometry) instead of $area. Please copy your comment as answer so I can accept it as solution. – Scrchd Jan 09 '23 at 08:25

1 Answers1

5

As stated in my comment, check Using area() or $area function in QGIS, when the data (polygon) is stored in UTM? for the difference between planimetric area area() and ellipsoidal area $area for more information.

ahmadhanb
  • 40,826
  • 5
  • 51
  • 105