I have a lines feature class with the following attribute table:
When I run the MultipleRingBuffer_analysis function using the following code (provided by user @Emil Brundage), buffers are drawn using the sum of the "width" column of the attribute table and a list of distances 10, 20 and 30 meters.
import arcpy
arcpy.env.workspace = "C:/data/Py.gdb"
fc = "lines"
distances = [10,20,30]
sr = arcpy.Describe(fc).spatialReference
#create feature class
arcpy.CreateFeatureclass_management("C:/data/Py.gdb",
"Multibuffers",
"POLYGON",
spatial_reference = sr)
#insert cursor to insert geometries into feature class
with arcpy.da.InsertCursor ("Multibuffers", ["SHAPE@"]) as iCurs:
with arcpy.da.SearchCursor(fc, ['SHAPE@', 'width','OID@']) as cursor:
for geom, width, oid in cursor:
#buffer in memory
arcpy.MultipleRingBuffer_analysis(Input_Features=geom,
Output_Feature_class=r'in_memory\buffs',
Distances=[i+width for i in distances],
Buffer_Unit='meters')
#iterate buffers and add to output feature class
with arcpy.da.SearchCursor (r'in_memory\buffs', ["SHAPE@"]) as sCurs:
for row in sCurs:
iCurs.insertRow (row)
#delete in memory buffers
arcpy.Delete_management (r'in_memory\buffs')
Output is one non dissolved feature class containing all the buffers as POLYGON objects (screenshot 1). I need to find a way to dissolve the buffers by ring iteration order in order to obtain something similar as screenshot 2 but with the right distances applied.