I'm working with QGIS 3.16 Hannover under MacOS 10.13 environment. I've got two polygon layers: natural_parks (multiple features) and region (single feature). Some natural_parks features lay entrely within the region feature, some lay completely outside and some are only partly within. I want to calculate the areas of the natural_parks features that do not overlap with the region feature, assigning a 0 value for those enterely within. Actually, what I need is calculate the marine area (in hectares) for each natural park. I built the following code in the natural_parks layer with the field calculator, but it doesn't work
case when overlaps($geometry, geometry(get_feature('region', 'id', 1))) = 1 then ($area - area(intersection($geometry, geometry(get_feature('region', 'id', 1)))))/10000 when overlay_disjoint('region') then $area/10000 else 0 end What's wrong with my code?
