# How to determine if an object is a circle

I have a polygon shapefile that consists of many different shaped features. I would like to identify only those shapes that are circles. Is there a way to do this? Is it a calculation I could do in the field calculator?

Thanks... I would calculate the thinness ratio, which for a perfect circle will equal 1.0. The formula for thinness ratio is: T = 4pi(A/(P*P))

• For a perfect circle, T should be 1. So anything near enough to 1 should be almost a circle. – AndreJ Mar 6 '14 at 6:34
• Thanks; you're right, and that makes sense! I guess the difference was how many digits of pi used - I only used a couple digits! – Darren Cope Mar 6 '14 at 13:11

For simple shapes in Cartesian space, just compare the area and perimeter -- if you solve A = pi*r1^2 and P = 2*pi*r2 for r1 and r2, and r1 == r2, then the figure is circular. Of course, projection and vertex density play a roll, but given your example, it should be easy enough to find an acceptable threshold.

• One more idea that you improve the threshold, is to set the threshold, based on the r (i.e. use a percentage threshold, instead of an absolute one). – Devdatta Tengshe Mar 6 '14 at 2:01
• Yes, the test would be 1-k < r1/r2 < 1+k, with k appropriately small (probably on the order of 1%) – Vince Mar 6 '14 at 3:16
• I think this is the neatest idea without breaking out into points. If you try to fit a circle, of course, a square will fit perfectly. – Alex Leith Mar 6 '14 at 3:41
• This is a much better approach and would execute much faster than my idea! – Hornbydd Mar 6 '14 at 14:22

Not sure this is the best method but one way is to extract centroid, compute the radius then use that to compute the circumference. Then compare your computed circumference with the perimeter length of the shape?

• I've used a variant of this to identify center point, semi-major, semi-minor, and orientation of an ellipse (on a spheroid), but it's probably too computationally expensive for simple rectangle/circle classification. – Vince Mar 6 '14 at 1:55

Just stumbled across this question through the Hot Network Questions and have no experience with any GIS software, but assuming a shapefile with polygons just boils down to arrays with points then you should just be able to compare the number of points on the object as polygon circles (or similar objects, but you seem to be working with either square-like shapes and circles) tend to have lots of points, whereas 'normal' shapes have at most around 30 (the most you have is 11). oh well, just an idea.

Only thing that might be troublesome is that smaller circles have less points, so alternatively you could take the average distance between any two subsequent points which should be far lower for circle-like objects.

Either way, if the `field calculator` is unable to do these kind of things, then please, just point it out and I will delete my answer, it was just surprising to see you guys discussing quite complex solutions to quite a seemingly simple problem.

• Low vertex count may not be the safest of assumptions, but use of Cartesian space often isn't either. – Vince Mar 6 '14 at 3:24
• The number of points is unsafe because some GIS software have parametric curves, and a square could be densified for different reasons. – radouxju Mar 6 '14 at 6:45