Suppose a polygon layer in QGIS with differently shaped polygons (no multi-geometries, let's keep it simple). Is there a way to calculate some kind of roundness characteristic of the individual polygons. I imagine a value of 1 would be a perfect circle and 0.01 would be some kind of lengthily stretched out polygon (and the edge case, 0 would be a line). In the Field Calculator, it would probably look something like this:

 exterior_ring( geom ) / $area

but I don't know what to put in geom to get a useful number. Of course, if there is a more elegant solution to get some kind of measure of shape, I am open for suggestions.

I need this to get rid of really thin polygons after a clip operation. I put that in bold, because I just noticed that's a really useful information!

I'd need a solution I can use in Field Calculator or with some plugin.

  • 1
    Something like gis.stackexchange.com/q/85812/2856 perhaps?
    – user2856
    Commented Sep 14, 2020 at 20:05
  • as soon as will have a layer with only valid geometries, we'll find out. Still cleaning, as fix geometries couldn't get the job done. Trying to eliminate duplicate nodes, now.
    – thymaro
    Commented Sep 14, 2020 at 22:46
  • @user2856 yes. and with that, I vote to close this question. Although the provided answer is a nice one, it doesn't replace or significantly add value to the answers to the related question.
    – thymaro
    Commented Sep 14, 2020 at 23:00
  • 1
    The other post is about calculating roundness which is a math problem. This one is about calculating roundness in QGIS which is a QGIS problem. Both are similar but not duplicate. Commented Sep 15, 2020 at 13:23
  • 1
    Yes, it is distinct enough. If you ask this question for ArcGIS, it also will be a different question. Commented Sep 15, 2020 at 13:49

1 Answer 1


Roundness is simply the ratio of the area of the circle with the same length as the polygon to the polygon area (area(Circle)/area(Polygon)) or vice versa (it depends).

Open Field Calculator, select field type, run the following expression:

($perimeter * $perimeter / (4*pi()) ) / $area

enter image description here

For a circle-shaped polygon, it returns ~1; for a square, ~1,27; for a line-shaped polygon, ~0.

This article includes other shape characteristics: Performance of shape indices and classification schemes for characterising perceptual shape complexity of building footprints in GIS

  • For one, nice paper, even the main subject is polygon complexity and not roundness per se. Secondly, I always get the same error, something like "cannot convert 'nan' to float" (I use a German speaking version), no matter what expression I try. I tried the following and keep getting the same error ($perimeter * $perimeter / (4*pi()) ) / $area $area * 4 * pi() / ( $perimeter ^ 2) $area * 4 * to_real( pi()) / ( $perimeter ^ 2) $area * 4 * round(pi(),5) / ( $perimeter ^ 2).
    – thymaro
    Commented Sep 14, 2020 at 22:02
  • I don't get any error. There could be invalid geometries in your data. Try to use Check Validity and Fix Geometry tools. Also Check $perimeter and $area of polygons by adding new fields. Commented Sep 14, 2020 at 22:15
  • Dixing geometries is a thought that crossed my mind after my application crashed. Restarting now and will do just that. Already added the two fields to delete faulty polygons of very small area and very small perimeter. Calculating Polby-Popper will give me the last crappy polygons, I hope.
    – thymaro
    Commented Sep 14, 2020 at 22:19

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.