# Calculating roundness/compactness of polygon?

I am trying to find ways to quantitatively describe the shapes of various polygons. For my project, these polygons represent lakes, rivers, lagoons, and parks. So they can be almost any shape. One easy metric is to calculate perimeter vs. area, which is at best an only slightly useful metric. But I would also very much like to be able to say something about the 'roundness' of a polygon. Or how 'compact' the shape is on a map.

The only way I can think of doing this easily is to calculate the area of each polygon in relation to a bounding box for that polygon (which I already have). But this seems like a poor solution.

So now I am thinking of something more like this - take the centroid of the polygon, add on a series of buffers of increasing areas (say 50%, 100%, 150%), then compare how much overlap there is between each buffer and the original polygon. A perfect circle will have perfect overlap at 100%, and I can use the 50% and 150% buffers to judge how much and in what way each polygon differs.

But even that feels cumbersome, and like a poor workaround for what somebody else has probably already figured out far better.

For reference, at a minimum I will need to be able to look at the resulting indices for the shape of various polygons, and be able to make an educated guess as to their source (River? Reservoir with dendritic shape? Lake/Lagoon? Park?)

• Definitely check out the Roundness Wikipedia Article for deeper thinking on the topic. Why not just create a buffer around the centroid that is the exact same area as the polygon, then measure the area outside of the buffer to create some type of score? Are you trying to get relative roundness between just the objects in this dataset, or does it need to be absolute roundness so they can be compared to other polygons outside of that dataset? Feb 7 '14 at 18:26
• Thanks for the response, that definitely helps. One of my challenges is that just comparing areas won't be enough - an oblong ellipsoid may have the same 'roundness index' as a dendritic shape using this index. Maybe using this roundness index in combination with the perimeter/area relationship will be able to capture those differences too, I have not done these sort of analyses before so I'll need to think on it. In the end, I'll only need to compare shapes within one dataset, but it is fairly large (1000s of polygons) Feb 7 '14 at 19:15
• True, but then you could filter those results using the area vs. perimeter metric to at least sort the shapes from simple to complex. A dendritic shape will have a relatively lower area-to-perimeter ratio (perfect circle has ratio of 1, square has ratio of 0.5, etc.) Definitely not an easy problem! You will have to use several metrics I imagine to achieve a robust "roundness score". Feb 7 '14 at 19:25
• Thanks for your input - I think from this point I have to try out these indices and see what sort of results I can manage. Then maybe I can come back with a more informed question for further help, if needed. I appreciate your time! Feb 7 '14 at 19:26
• Keep in mind that interior rings (holes) and multiple parts will render area-v-perimeter comparison useless. You can use just the exterior rings for generating a metric, but weighting values from the individual parts could be a challenge. Feb 7 '14 at 21:40

The compactness of an object can be measured using the Polsby-Popper test by determining the Polsby-Popper (PP) score.

The PP score is determined by: multiplying the polygon's area by 4pi and dividing by the perimeter squared. Using this, a circle will have a score of 1 and any other geometric shape has a smaller ratio.

disc :(4*PI)* PI*R² / 4PI²R²= 1

square : (4*PI) * C² / 16 * C² = PI/4 ~=0.78

Another usefull index could be the lenght/width of the smallest enclosing rectangle (see the minimum bounding geometry tool). But in this case the square and the circle are alike and concavity is ignored.

As a last recommendation, if you work with perimeter, it is usefull to "smooth" your object before computing the indices, in order to avoid "fractal" effect (especially if your polygons come from raster to polygon conversion)

• This helps, thanks. My polygons don't come from rasters, but that is an excellent point I hadn't even considered! I'll definitely do that. Feb 7 '14 at 19:27
• Source of formulas? Feb 7 '14 at 19:43
• Sorry, I don't remember :-~. Probably in a paper about landscape ecology. I used it for the first time a long time ago, and I added the "normalisation" for more convenience. Feb 7 '14 at 19:53
• @Taylor This is one of many possible characterizations of "compactness." Typical methods compare the feature's area to a measure of its tortuosity or spatial extent. The latter measures can include not only perimeter but also diameter and sizes of bounding features (such as minimum-area bounding box, minimum-area bounding ellipse, and circumcircle). More exotic ones would include areas of various buffers and an estimated fractal dimension. The challenge in most situations lies not in computing these measures but in deciding which one is most relevant to the application. Feb 9 '14 at 17:28

In addition to the roundness formula outlined by radouxju in his response and others like the ratio of the area of the polygon to the area of its minimum bounding circle - `ST_Area(geom)/(ST_Area(ST_MinimumBoundingCircle(geom)) as rnd_check` in PostGIS: I find it often helps to check the number of vertices/points in a 'suspicious' geometry - `ST_NPoints(geom)` in PostGIS.

The stuff I do is different from what you're describing, but I find that the NPoints filter helps discriminate between property parcels (which can actually be long and skinny, of course) and rivers and other long-skinny natural features. There's the odd long, skinny property parcel that borders a river, but anomaly-checking is why we get paid the big bucks (HA!): they invariably have one side (at least) that's straight for a goodly portion of the feature's length, so job's done.

Also, it's rare (in my workflow) that there's not some aspatial identifier that can't be brought to bear, and in any case a lot of my work is set up so that we're analysing 'delta' (changes across time) so if the data at T=0 is clean and nobody's introduced 'negative enhancements' for T ∈ [0, t-1], then delta for an entire state for `T=t|t-1` can be done in half a day.

Loads of points in a thing that's long and skinny and doesn't have any single line that's ... probably a river.

A reservoir with a dendritic shape would certainly challenge that guess, but it's likely that filtering on the overall length of the shape might yield results if the entire river is one polygon (we should be so lucky) - or find the number of paths from the 'narrow' end to the fat end (the number of branches).

Lake vs park... I would try to do that by aerial/satellite imagery, given my druthers: it's a way easier problem to use a land/water classifier where the region to be checked is known, than trying to identify and extract a water region from an image where the location of the water is not known.

I also found this answer (to a different question) very useful for discriminating between long-skinny features.

I was facing a similar problem, and ended up solving the equation for both circumference and area of a circle to make them equal one another like so:

2*pi*r = c <=> r = c/2*pi pi*r^2 = a <=> r = sqrt(a/pi)

c/2*pi = sqrt(a/pi) <=>

sqrt(a/pi)

-------------- = 1

c/2*pi

This index is between 0 and 1 where 1 is a perfect circle. I don't know is this is an established method but I would love to hear from anyone who might have seen it elsewhere.

• Nice development from scratch. this is the rationale of Polby-Popper that I mentioned in my post, except that you took the square root. basically it won't change the ranking if you square root it (or not) Jul 24 '19 at 11:48

WhiteBox Tools has a suite of tools for computing shape metrics have a look at the manual here. If you are an ArcGIS user they expose the tools in a user friendly toolbox, this can be downloaded here.