3

I am trying to create the largest possible circle inside a polygon including its perimeter and area size. I created via minimum boundary geometry the smallest possible circle outside a polygon (see image) and want to do some calculation with its largest circle inside the polygon. I have a shapefile of 25 polygons. Each has to have its own largest circle. This circle can be anywhere in the polygon, not necesserily at the centre since my polygons are uneven.

enter image description here

I tried looking at Find maximum radius of circle that will fit within an irregular polygon? but it was no success. I have the same problem as the OP.

3
  • 1
    The answer you mention covers wat you want, what are the problems you are facing with the procedure described? Oct 6 '15 at 13:03
  • as the OP mentioned in his question, he tried the answer also, but the circle did not cover the largest area. In his example, the north area has a larger area, so a larger circle is possible in that area. I also want to calculate the largest possible circle, but not from its centroid, but from the best possible location inside the polygon
    – user30058
    Oct 6 '15 at 13:07
  • imgur is blocked here so I can't see the images that go with the answer in the linked question. Hopefully my answer below works.
    – DMusketeer
    Oct 6 '15 at 14:54
5

I have worked up an answer in ArcMap and using ET Geowizards (as it is what I have access to but I think the same tools exist in ArcMap but require more than a basic license):

  • Convert polygon to point using 'Deepest Point' option (i.e. maximising distance from the edge of the polygon giving you the most room for the circle.
  • Buffer points using the 'ET_Depth' attribute generated by the previous tool (Initially I spent some time trying to use some sort of 'nearest' tool to calculate the shortest distance between the point and he edge of the polygon but it turns out this is given by the first tool, you may need to do this if you don't want to use ET geowizards).

I haven't fully tested this so, maybe I missed a polygon shape that wouldn't work (conceptually I can't think of one). The bottom left one in the rectangle is interesting because the circle could be anywhere down the polygon and be just as valid. I guess it is at the top because the tool start works systematically top left to bottom right.

Circles

0
1

Some term this is as girth and the University of Connecticut, Center for Land Use Education & Research, has developed a free geoprocessing tool (Shape Metrics) to calculate this among many other shape metrics. This is mentioned in the link as an index but it is quite easy to find the radius from the formulae given. You can download it from the link, https://clear.uconn.edu/tools/Shape_Metrics/Shape%20Metrics.zip

Two important points (after Hornbydd's comment), the radius derived may not be the exact solution but a good-enough approximation and the tool does not give you the centre of the girth (centroid of circle) or create a circle polygon as output.

2
  • This is an interesting set of tools, so I downloaded it to have a look but the tool does not actually create a circle as an output. Looking at the source code it just computes a "girth" index. Even if you could back calculate the area of the circle the code offers no mechanism for locating it within the polygon. Whilst this tantalising comes close I don't think it solves the OP request. Interesting set of tools thought.
    – Hornbydd
    Aug 14 '19 at 13:55
  • @Hornbydd, fair point, I did not pay attention to "create a polygon" part, just concentrated on radius, area and perimeter arguments. After you, I had a look at the code and I do not think this is the exact max radius of inscribed circle but a result of heuristic approach through a custom densification of the vertices and finding the max length among them. I have updated the answer.
    – fatih_dur
    Aug 15 '19 at 0:23
1

This is basically a skeletonization problem.

Calculate the shortest distance from every interior point to the edge of the polygon. The maximum of this set of values is the radius of the largest circle that will fit in the polygon and any interior point which has this maximum value is a valid center for that circle. There may be more than one center and more than one valid circle. In fact, for any polygon except a perfect circle, there may be one or more connected lines (the "skeleton") along which an infinite number of points lie that are at this maximum distance. Since there are infinite interior points, a grid or regularly-spaced point array of the the appropriate precision, say 0.5 feet or 0.5 meters, will yield a precise approximation.

The pure vector approach would be to create a regular rectangular or triangular array of points and then calculate the distances from all of those points interior to the polygon to its edge. Find the points with the largest distances (rounded to the same precision as the mesh). Use these points to draw your circles (a buffer of the distance).

You could also use a hybrid raster/vector approach. First, convert the polygon and its edge to raster grids, Second, calculate the minimum euclidean distance from each polygon cell to the edge raster cells. Third, get the maximum of the minimum distances. Fourth, convert the maximum cells back to points and use them to draw your circles.

[EDITED]

The approach described above is essentially the one used by the Girth metric from ShapeMetrics mentioned in an other answer. From the the girth for each polygon a negative buffer of the polygon to the girth minus the precision desired will yield the polygon eroded by the girth and the contained centroid of the eroded polygon is an ideal location for the circle.

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.