# Finding distance from center of polygon to its furthest edge/point?

I have thousands of 2D irregular contours a shown. They are tree and other vegetation contours. I would like to come up with a representative radius from their centroid to their further edge/point with arcgis. I have spatial and 3d analyst licenses just don't see a way. I have already generated their centroids in a separate file.

Any advice on how I can proceed?

• You could test the distance from the centroid to every vertex and record the maximum. For help with that we would need to see a code attempt first. I suspect that this question may have been asked on this site before.
– PolyGeo
Commented Aug 14, 2017 at 19:36
• I can give you a good answer in SQL PostGIS...but @PolyGeo is right you would need to find the distance from each polygon centroid to the boundary of the polygon and take the max Commented Aug 14, 2017 at 19:37
• gis.stackexchange.com/questions/133099/… Commented Aug 14, 2017 at 20:50
• Thank you for the suggestions, response, and link. I did search for a while but was not lucky in finding a similar question prob because I was focusing on furthest.. anyway, the bounding box function is enough for now but I will keep these in mind if I need something more precise.
– LCK
Commented Aug 14, 2017 at 21:50
• Perhaps radius of largest inscribed circle is what you need gis.stackexchange.com/questions/147790/… Commented Aug 15, 2017 at 4:06

Perhaps you would be happy by computing minimum bounding circles for your polygons. See http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/minimum-bounding-geometry.htm

You will get a new measure as an attribute:

For CIRCLE, the new field and measurement are:

``````MBG_Diameter—The diameter of the resulting circle.
``````

Your best bet is to convert feature vertices to points, and then iterate through each midpoint and perform a `point distance` on its correlating polygon vertices. This will be a slow process, but I'm not aware of any other process that will work for you.

In the below example, I create a dictionary with polygon UIDs as its key and the furthest distance as its value. The script makes use of the `Point Distance` tool, which requires and advanced license. If you don't have an advances license I've written a blog with a custom `Point Distance` here.

``````#centroid points
centroidFc = r"C:\data.gdb\Test_Midpoints"
#polygons
polyFc = r"C:\data.gdb\Test_Polygons"
#unique ID field. shared in both feature classes
uidFld = "UID"

import arcpy

#feature verts to points
featVertFc = r"in_memory\vertPnts"
arcpy.FeatureVerticesToPoints_management (polyFc, featVertFc)

#empty dictionary
di = {}

#iterate midpoints
with arcpy.da.SearchCursor (centroidFc, [uidFld]) as curs:
for uid, in curs:
#sql for selection
sql = "{} = {}".format (uidFld, uid)
#create feature layer with sql applied
arcpy.MakeFeatureLayer_management (centroidFc, "Test_FeatureToPoint", sql)
arcpy.MakeFeatureLayer_management (featVertFc, "Test_VertPoints", sql)
#create point distance table
arcpy.PointDistance_analysis ("Test_FeatureToPoint", "Test_VertPoints", r"in_memory\PntDist")
#get table max
maxDist = arcpy.da.TableToNumPyArray (r"in_memory\PntDist", "DISTANCE")["DISTANCE"].max ()
di [uid] = maxDist
#clean up
for fil in ["Test_FeatureToPoint", "Test_VertPoints", r"in_memory\PntDist"]:
arcpy.Delete_management (fil)

arcpy.Delete_management (r"in_memory\vertPnts")

print di
``````

Result:

• Keep forgetting that Point Distance tool exists, nice! One additional note is that it is an Advance licensed level tool. So not everyone will be able to use it. Commented Aug 15, 2017 at 8:58
• @ Emil, much appreciated! I will try it, definitely. I believe the ',' in the for loop will cause a hick up.
– LCK
Commented Aug 15, 2017 at 10:05
• @LCK the ',' is purposeful and a means of unpacking each row. Commented Aug 15, 2017 at 12:42
• I've added your blog to my RSS feeds, so hopefully I will never miss any golden nuggets you create! Commented Aug 15, 2017 at 16:01

One technique could be this:

1. Convert you polygons to polylines
2. Run the Near or Generate Near Table tool

As you have extracted the centroid already, logically the polyline that surrounds it must be the nearest edge.

But you specifically state you want the furthest edge, so you would need to convert your polygon to it's constituent vertices and test all scenarios.

This could be easily wrapped up in a model.

You say you want a "representative radius" so alternatively you could extract the minimum bounding box and it's width may be sufficient?

• Thanks.. somehow I thought that was for points only. thank you.. the bb works.
– LCK
Commented Aug 14, 2017 at 21:53