3

I have a multipolygon layer, in which some geometries are circles, drawn in an unknown GIS. How can I select only those features which are circular? A quick manual check confirms that circular features do not all have the same number of points/vertices.

2
7

You could use the field calculator in order to check whether the minimal circle differs much from the actual shape, e.g. by calculating the $area.

if(area(minimal_circle($geometry))<$area*1.05,1,0)

This checks, whether the the area of the minimal circle is smaller than the area of the original geometry times 1.05 (5 % tolerance accounting for different number of vertices) and will select the geometry, if this is the case.

2
  • Am I right that this works for single-part, but not multiparts? I guess minimal_circle() is for the whole feature, not the parts. I'll see if I can handle taht in the expression as well. – Tom Chadwin Feb 10 at 16:30
  • 1
    The minimal circle computation is probably a bit expensive to compute - use the ratio of perimeter to area and the fact that a circle has the maximal perimeter:area ratio of any shape. Features with more than one ring can't be circles so filter those out first? – Spacedman Feb 10 at 16:52
4

The isoperimetric quotient of a circle in a plane equals 1. You could explode your multipart features. Add a new attribute and calculate the area of your polygons. Add a new attribute and calculate the perimeter of the polygons. Then use the field calculator to generate the IQ of the polygons in the attribute table using this formula:

Q = 4 pi A / P^2

For shapefiles the polygons will never be perfect circles since each will be using points to define the shapes of the polygons but the polygons with IQs closer to 1 will be circles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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