[GIS] How to split circles in 8 quadrants

arcgis-9.3arcgis-desktopgeometry

I am using ArcGis 9.3 and I need to split a large number of circles in quadrants. The circles corresponde to a 200m buffer of a point layer and, for each point, I need to split the buffer in 8 quadrants. Is there any ArcGis tool or extension that does this for all points/buffers at the same time?

Best Answer

I've written a script for 10.1/10.2, however you might see if it is possible to rewrite it for 9.3. I've almost never used arcgisscripting, but I guess it would be hard to implement the same without arcpy in 10.0+. Bearing Distance To Line GP tool I've used is available only in 10.0+, too.

If 9.3 is your only option, you could try to generate the lines with arcgisscripting in 9.3 (with the same logic as I've used with arcpy in the code below) and then use ET Geowizards Partition Polygons with Polylines which works similar to Feature To Polygon GP tool in ArcGIS. Another tool that looks promising is Points To Pie Segments from ET Geowizards.

If you will be able to get 10.1+ via evaluation license or if you upgrade, then you could use this script. All other users who find this post and are on 10.1+ could also benefit from using this script. This script assumes your source points you've used for buffering represent the centroid of the output buffer circles.

import arcpy, math

arcpy.env.overwriteOutput = True
arcpy.env.workspace = r"C:\GIS\Temp\test.gdb"
tempworkspace = arcpy.env.workspace
in_poly_fc = r"C:\GIS\Temp\test.gdb\CirclesFeatureClass"
clip_lines_fc = r"ClipLines"
sum_lines_fc = r"SumClipLines"

#converting an existing fc with circles to Geometry objects
geometries = arcpy.CopyFeatures_management(in_poly_fc,arcpy.Geometry())

for feature in geometries:
    #obtaining a centroid of the circle centroid via Geometry class attribute
    centroid_Point = feature.trueCentroid
    centroid_xy = []

    #obtaining XY coordinates of the centroid via Point class attribute
    centroid_xy.append(centroid_Point.X)
    centroid_xy.append(centroid_Point.Y)

    #obtaining the radius
    #have to add a small overhead value to make sure the radius end point will overshoot the polygon
    #otherwise may get undershooting lines which depends on the precision of the coordinates
    #and XY tolerance of the source data
    radius = math.sqrt(feature.area / math.pi) + 1

    #supply the list of angles for bearing
    bearing_angles = [0,45,90,135,180,225,270,315,360]

    #creating bearing angles table and adding fields
    bearing_table = arcpy.CreateTable_management(tempworkspace,"BearingDataTable")
    arcpy.AddField_management(bearing_table,"Xcoord","Double")
    arcpy.AddField_management(bearing_table,"Ycoord","Double")
    arcpy.AddField_management(bearing_table,"Bearing","Double")
    arcpy.AddField_management(bearing_table,"Distance","Double")

    #inserting all required lines constructed from centroid with the radius and bearing angle
    with arcpy.da.InsertCursor(bearing_table,["Xcoord","Ycoord","Bearing","Distance"]) as ins_cursor:
        for bearing_angle in bearing_angles:
            ins_cursor.insertRow((centroid_xy[0],centroid_xy[1],bearing_angle,radius))
    del ins_cursor

    #projected coordinate system used for output lines feature classes generated
    project_coordsys = """PROJCS['NAD_1927_StatePlane_Alabama_East_FIPS_0101',GEOGCS['GCS_North_American_1927',
    DATUM['D_North_American_1927',SPHEROID['Clarke_1866',6378206.4,294.9786982]],PRIMEM['Greenwich',0.0],
    UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],
    PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-85.83333333333333],
    PARAMETER['Scale_Factor',0.99996],PARAMETER['Latitude_Of_Origin',30.5],
    UNIT['Foot_US',0.3048006096012192]];-17948200 -43887100 3048,00609601219;
    -100000 10000;-100000 10000;3,28083333333333E-03;0,001;0,001;IsHighPrecision"""

    arcpy.BearingDistanceToLine_management(bearing_table,clip_lines_fc,"Xcoord","Ycoord",
                                           "Distance","Feet","Bearing",spatial_reference=project_coordsys)
    #adding each circle's 8 lines in iteration to the sum output line feature class
    arcpy.Append_management(clip_lines_fc,sum_lines_fc,"NO_TEST")

    #deleting temp feature classes to avoid locking issues at next iteration
    arcpy.Delete_management(bearing_table)
    arcpy.Delete_management(clip_lines_fc)

#cutting each circle in the polygon feature class by using the lines obtained earlier
arcpy.FeatureToPolygon_management([in_poly_fc,sum_lines_fc],"Quadrants","#","ATTRIBUTES","#")

The source polygon feature class with circles:

enter image description here

The processed circles, each divided into 8 segments:

enter image description here

Related Question