6

irregular polygons

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 Aug 14 '17 at 19:36
  • 1
    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 – ziggy Aug 14 '17 at 19:37
  • 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 Aug 14 '17 at 21:50
  • 1
    Perhaps radius of largest inscribed circle is what you need gis.stackexchange.com/questions/147790/… – FelixIP Aug 15 '17 at 4:06
7

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.
6

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 ()
        #add to dictionary
        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:

enter image description here

  • 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. – Hornbydd Aug 15 '17 at 8:58
  • @ Emil, much appreciated! I will try it, definitely. I believe the ',' in the for loop will cause a hick up. – LCK Aug 15 '17 at 10:05
  • @LCK the ',' is purposeful and a means of unpacking each row. – Emil Brundage Aug 15 '17 at 12:42
  • @Hornbydd Annoying advance license. I've added a link to my blog where I offer code for generating a point distance table without the advanced license. – Emil Brundage Aug 15 '17 at 15:45
  • I've added your blog to my RSS feeds, so hopefully I will never miss any golden nuggets you create! – Hornbydd Aug 15 '17 at 16:01
1

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 Aug 14 '17 at 21:53

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.