Creating Wedge-Shaped Buffers

06-05-2012 01:37 AM
New Contributor
Hi All,

I am looking to create wedge-shaped buffers around a series of points in a point data layer.  Basically these wedges need to be sections of a circle with a user-defined (possibly from fields in the attribute table of the point data layer?) start bearing, end bearing and radius, where the original point is situated at the tip of the wedge.  This is to represent a surveyed section of sea from a static survey point.

Looking for a solution to this I found the following link from an old ArcGIS forum: This provided the code pasted below for doing this. 

However, I'm having trouble using this code and can't quite work out how best to load this into ArcGIS and what bits I need to customise/change for my specific computer/settings.  I think this is also written for ArcGIS 9.3, while I am using ArcGIS 10.0. If it is relevant, the computer I am trying to use this on is running 64 bit Windows 7.

Any suggestions of how to use this code, or of any other/better ways to create wedge-shaped buffers would be greatly appreciated.

All the best,


Code from old ArcGIS forum:

import win32com.client
import math, os, os.path
from win32com.client import Dispatch
GP = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")
GP.workspace = "C:\\temp\\"

#The function that makes the wedge-shaped buffer
def MakeWedge(point, radius):
    cArray = GP.CreateObject("Array")
    p0_x = point[0]
    p0_y = point[1]
    p1_x = p0_x + radius
    p1_y = p0_y
    center = GP.CreateObject("Point")
    del center

    #Specify the starting and ending radians - starts at East and goes counterclockwise   
    for i in range(0, 91):
        cPoint = GP.CreateObject("Point")
        p2_x = p0_x + math.cos(math.radians(i))*radius
        p2_y = p1_y + math.sin(math.radians(i))*radius = i
        cPoint.x = p2_x
        cPoint.y = p2_y
        del cPoint   
    return cArray

    outfc = "wedges_80km.shp"
    for i in range(0, GP.MessageCount-1):
        print str(i+1)+':\t'+GP.GetMessages(i)+'\n'
    rows = GP.SearchCursor("anop_spm.shp")
    #Reset the cursor to the top.
    row = rows.Next()
    #Loop through each record in the shapefile
    while row:
        long = row.GetValue("LONGITUDE")
        lat = row.GetValue("LATITUDE")
        radius = 80000
        cur  = GP.InsertCursor(outfc)     
        feat = cur.NewRow()
        #call the function MakeWedge
        feat.shape = MakeWedge((long, lat), radius)
        #go to next record in shapefile
        row = rows.Next()
    for i in range(0, GP.MessageCount-1):
        print str(i+1)+':\t'+GP.GetMessages(i)+'\n'

del GP
0 Kudos
2 Replies
New Contributor III
I work with E911 wireless data all the time that uses "sector wedges" for default coverage direction.  It's certainly not the same thing, but you might be able to tweek it a bit to get the desired results.  It takes a lot of other data that you could probably default with 'a' and '1', but the important thing is it takes an orientation, radius, and wedge width.

side note:  This is NOT my script.  The guy that wrote this is a million times smarter than me.
0 Kudos
New Contributor
Hi Smkruzik,

Thanks for pointing me in the direction of that great little Add In.  It works perfectly for what I am needing to to (in this case it is identify the areas of sea that are surveyed from given land-based surey sites). There wasn't even too much fiddling around to get the exact outputs that I needed.  I can see it being used quite a lot by ecologists (my field of study), even though its designed for working with Wireless coverages, as this is the type of thing we need to do quite often.

Thanks again.

All the best,

0 Kudos