I am trying to create multiple buffer rings of 1 mile and 2 mile for a polygon. I tried the MulipleRingBuffer Analysis but it take about 2 minutes to do 2 buffer rings. so i am trying the buffer analysis. I have the following script, it creates the 1 mile and the 2 mile feature classes but it's on the outline of the subject polygon . I do not get an error but some how i am not correctly getting what i am after, any help would be great.
import arcpy, os
mxd = arcpy.mapping.MapDocument("CURRENT")
lyr = arcpy.mapping.ListLayers(mxd, "SUBJECT_PROPERTY")[0]
#lyrpath = lyr.workspacePath
arcpy.env.workspace = os.path.dirname(mxd.filePath)
wp = os.path.dirname(mxd.filePath)
try:
SP = "SUBJECT_PROPERTY"
lyr.replaceDataSource(wp, "SHAPEFILE_WORKSPACE", SP, True )
except:
pass
if arcpy.ListFields(SP, "BUFF_DIST"):
print "Field exists"
else:
arcpy.AddField_management("SUBJECT_PROPERTY","BUFF_DIST","TEXT",10)
arcpy.RefreshActiveView()
arcpy.RefreshTOC()
distances = [1, 2]
for distance in distances:
outfile = "wp%s" % distance
arcpy.Buffer_analysis(SP, outfile, distance, "OUTSIDE_ONLY", "ROUND", "LIST", "BUFF_DIST")
Solved! Go to Solution.
Well... if your map is a projected map with feet or meters as coordinates... then you just buffered by 1 and 2 feet... basically making what looks like a fat line... The help topic on Buffer_Analysis has some tips
I was able to get the features to be created by adding "Miles" to the following line.
distances = ["1 Mile", "2 Miles"]
Why isn't the BUFF_DIST being populated with 1 mile and 2 mile for each new feature class?
maybe it is a numeric field and you have chosen the text representation of the distance... why not check the field type
Well... if your map is a projected map with feet or meters as coordinates... then you just buffered by 1 and 2 feet... basically making what looks like a fat line... The help topic on Buffer_Analysis has some tips