I recently purchased David Allen's GIS tutorial and I'm stuck on exercise 2.3. The objective is to buffer multiple paths with variable buffer distances based on the length of the path -step 7 (I'm stuck here). The exercise uses a search cursor to go through each path and buffer accordingly. The data are available with the book here. I know the buffer line is incorrect, it needs to call fcName and wellBuffDist.
It would be helpful to see the full script...if anyone has already completed this exercise. Thanks.
try:
import arcpy
from arcpy import env
env.workspace = r"C:\EsriPress\GISTPython\Data\City of Oleander.gdb\Well_Data"
env.overwriteOutput = True
fcName = "BC_South_3H_Path"
wellCursor = arcpy.da.SearchCursor(fcName,["Shape_Length"])
for row in wellCursor:
drillLength = row[0]
def wellBuffDist(drillLenght, wellBuffDist):
if drillLenght < 3000:
wellBuffDist = 75
elif drillLenght >= 3000 and drillLenght < 4000:
wellBuffDist = 175
else:
wellBuffDist = 300
# Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script
# The following inputs are layers or table views: "BC_South_3H_Path"
arcpy.Buffer_analysis(in_features="BC_South_3H_Path",out_feature_class="C:/EsriPress/GISTPython/MyExercises/Scratch/Temporary Storage.gdb/SelectionBuffer",buffer_distance_or_field="300 feet",line_side="FULL",line_end_type="ROUND",dissolve_option="NONE",dissolve_field="#")
print "great job!"
except:
print "do over"