5

I am trying to use the QGIS Field Calculator to calculate the area of a feature. When I do this, the area returned is calculated using the planimetric method. This differs to $area which uses the ellipsoidal method.

When I try area(intersection(feature1, feature2), it returns the planimetric area, but I need the ellipsoidal area.

How can I change the method of the area command from planimetric to ellipsoid in QGIS? Or is there a way to get the ellipsoidal area of intersection(feature1, feature2) in Field Calculator?

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
hojkoff
  • 241
  • 1
  • 6
  • 2
    Why do you need to change? $area already gives ellipsoidal area. – Kadir Şahbaz Sep 22 '20 at 18:47
  • This response isn't helpful. The question is not, WHY do I need this, it's HOW do I do it. There is clearly more going on in the background than this question outlines. You don't need to know why. – hojkoff Sep 23 '20 at 08:09
  • 6
    I asked so, because there are two different methods to calculate an area in Field Calculator. 1. area($geometry) which returns the planimetric area, 2. $area which returns ellipsoidal area. Which method do you use to calculate the area of a feature? – Kadir Şahbaz Sep 23 '20 at 08:37
  • What I understand from your question is "How can I change area($geometry) to calculate ellipsoidal area instead of planimetric area?". If you mean that, you need to change source code of QGIS. – Kadir Şahbaz Sep 23 '20 at 08:52
  • In that case, why didn't you respond first time with, "this isn't possible as the method is baked into the source code and there is no function to convert between a planimetric and ellipsoidal calculated areas" instead of, "why do you need to do this"? There is no need for the constant asking, why why why, on this site. I'm here for answers not questions. Answer the question or don't. Since you have asked, I need the area of an intersection, but in the same output format as the $area command. When I do, "area(intersection( feature1, feature2)" it doesn't give me that. – hojkoff Sep 23 '20 at 10:02
  • 2
    The question in my first comment is just an ordinary, a usual question that we, volunteer answerers, usually ask to understand what the post owner exactly needs and asks. Well, yes, I did understand your question as "How can I change area($geometry) ...." and I asked (in my first comment) like that because I was unsure you asked what I understood. – Kadir Şahbaz Sep 23 '20 at 10:38
  • 1
    I tried to make a new function in Field Calculator, I couldn't figure it out how to solve this problem. Though, it looks like the best way is to make a new custom expression function like area_v2(feature1, feature2). There is a simple tutorial here. – Kadir Şahbaz Sep 24 '20 at 21:49

1 Answers1

2

You can transform the geometry inside the area() function of QGIS expression to a local CRS where the difference between planimetric and ellipsoidal measurements are minimal - be it UTM zone of your area of interest or any other.

As local CRS, I use EPSG:2056 for Switzerland for demonstration purpose. My polygon layer is in EPSG:3857, so the difference between planimetric and ellipsoidal measurements is high. I use this expression on the layer with layer CRS EPSG:3857 to get measurements in EPSG:2056:

area (
    transform (
        intersection ([feature1], [feature2]),
        'EPSG:3857',
        'EPSG:2056'
    )
)

All layers in EPSG:3857. Measurement of the intersection in the middle with the expression above: 956'301; intersection created as a separate layer and calculation of ellispoidal area: 956'281, so quite close: enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208