I have to make multibuffer to a several shp’s (30 or +) and with this code the it takes 30 minutes or more.
import arcpy,time,glob,os
def multibuffer (probe,Zona_trab,nombarch3,recortes2):
x=0
bufdef = (Zona_trab,"\bufferRing",time.strftime("%H%M%S"),".shp")
bufferRings = ''.join(bufdef)
if probe == 1:
with open (nombarch3) as p:
for x in recortes2:
dtaring = p.readline()
arquet, valbuf2, datperm= dtaring.split(",")
valbuf2=float(valbuf2)
a= valbuf2*0.3
b= valbuf2*0.5
c= valbuf2
distances = [a,b,c]
puntselec1a2 = (Zona_trab,"\puntsele",x,".shp")
puntsele2 = ''.join(puntselec1a2)
print puntsele2
print distances
arcpy.MultipleRingBuffer_analysis(puntsele2,"capadeRingbuff"+str(x)+".shp", distances, "meters", "", "ALL")
p.close
wcard="puntsele*"
try:
dir=Zona_trab+os.sep+wcard+'.shp'
flist=glob.glob(dir)
arcpy.Merge_management(flist, bufferRings)
except:
print "error"
The code works, it have no errors, so it will work slow, but safe. My question is:
what would you do for speed up the process?
EDIT 1:
The first part of the program is done instantly, but this call:
arcpy.MultipleRingBuffer_analysis(puntsele2,"capadeRingbuff"+str(x)+".shp", distances, "meters", "", "ALL")
Make the stop of several minutes in the script.
With this new info, someone know how to speed up this part? Doing several MultipleRingBuffer at once or something like that? (I think is not posible to make that)