Skip to content

Instantly share code, notes, and snippets.

@CodeWithCory
Created June 1, 2016 20:20
Show Gist options
  • Save CodeWithCory/9d746c7db0f78902ed79671e4a05fd63 to your computer and use it in GitHub Desktop.
Save CodeWithCory/9d746c7db0f78902ed79671e4a05fd63 to your computer and use it in GitHub Desktop.
# Cory Rahman
# This script must be added to an ArcGIS Toolbox (.tbx) in order to run
# Python 2.7.8
import arcpy
import numpy
import os
import Tkinter
import tkFileDialog
#ArcPy!!
def perform():
directory = arcpy.GetParameterAsText(0)
typevar = arcpy.GetParameterAsText(1)
radius = arcpy.GetParameterAsText(2)
print "Opening Directory: ",directory
arcpy.env.workspace=directory
print
print "Directory Opened"
file_list = arcpy.ListFeatureClasses(feature_type = typevar)
print "Creating buffer(s)..."
x=0
for feature in file_list:
arcpy.Buffer_analysis(in_features=file_list[x], out_feature_class=\
file_list[x]+"_ArcPyBuffer", buffer_distance_or_field=radius)
x+=1
print x," buffer(s) created"
print "All buffers created."
print "Buffers saved to ",directory
perform()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment