3

Is it possible, with QGIS, to get the area of a single part of a multi polygon? Or do I have to split them into single polygons?

enter image description here

1
  • 3
    What do you mean by "get"? Visualize the areas as in the image or obtaining the areas to use, for example in a script, later? Feb 14, 2022 at 19:37

2 Answers 2

8

Using Field Calc and Expressions:

expression used:

array_foreach(
      generate_series(1, num_geometries($geometry)),
          round(area(geometry_n( $geometry,@element)),0))

enter image description here

7

Using a script, you can get easily the areas.

  • You need to check if it is multipart.
  • parts method of QgsGeometry returns an iterator for parts
layer = iface.activeLayer()

for feat in layer.getFeatures():
    geom = feat.geometry()
    if geom.isMultipart():
        areas = sorted([part.area() for part in geom.parts()])
        print(feat.id(), areas)

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.