import arcpy city_pts = "C:\Urban_Land_Project\Cities\WI_cities.shp" buffer_sizes = [1,2,4,7,10,15,20,30] for distance in buffer_sizes: out_shape = "C:\Urban_Land_Project\City_buffers\WI_city_buffers{}km.shp".format(distance) out_km = "{} Kilometers".format(distance) arcpy.Buffer_analysis(city_pts, out_shape, out_km, "FULL", "ROUND", "NONE", "#")
I have a point file and I need to make a lot of buffers in specific increments but I can't figure out how to interate through a list inside the buffer function. Here is what I have:import arcpycity_pts = "C:\Urban_Land_Project\Cities\WI_cities.shp"buffer_sizes = [1,2,4,7,10,15,20,30]for x in buffer_sizes: arcpy.Buffer_analysis(city_pts, "C:\Urban_Land_Project\City_buffers\WI_city_buffers*km.shp","2 Kilometers" ,"FULL","ROUND","NONE"," #")I need to have each buffered file to be named "WI_city_buffers*km.shp" with the * being the buffer size. How do I get the arcpy.Buffer_analysis to go through my list?
r"C:\Urban_Land_Project\City_buffers" + "\\" + "WI_city_buffer" + str(x) + "km.shp"
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.