I am having trouble buffering multiple feature classes within a GDB. These feature classes were just created based on a select by attribute and copy features tool run.
I have attached a copy of my script. The buffer analysis begins at the bottom, I have tried various parameters and dont know the variable that will be my input features that are the selected krogers from each county.
Thanks a lot!
do you think it should be something like this ^^
Here's what your for-loop says:
- For each feature class:
- make a feature layer
- make a selection in the feature layer
- copy the feature layer somewhere
- buffer the feature class
here is the output from the script ran above.
its just running the buffer on the wrong fcs.
do you think I should run another
listFeatureclass_management with the where clause being something like (*krogerselection)
and then for fc in fcList:
arcpy.Buffer_analysis
I believe you are overthinking how all this works too much.
fc isn't an object, but is holding a string value, which is the name of the feature class in your gdb. so when the buffer tool see fc, its actually reading the string that it contains and check your workspace for a fc with that name. You need to have it use a string of your selection FC as input, so all you need to do is have the input add the rest of the file name to it.
So you would want
arcpy.Buffer_analysis(fc + "krogerselection" , blahblah other parameters) to get the selection fc(Bro_ADDSkrogerselection for the first time through the loop)
instead of
arcpy.Buffer_analysis(fc, blahblah other parameters) that gets regular fc(Bro_ADDS for the first time through the loop)
when i run it like that, it creates a buffer for the original fcs in the GBD...
not the new kroger selection fcs.
So I think I just need to figure out what the variable is for the newly created BRO_ADDSkrogerselection (etc.) fcs.
Thanks everybody.
does anyone know why my script is stopping after print "features copied and not continuing on to the next line of code..... the list feature classes line.
you didn't set the list equal to a variable like you did with the first listfeatureclasses
ok thank you for all the help!!!
I am going to set this fc variable to equal feature class ending in kroger selection
and then run the buffer in this for loop.
I think I have a wayyyyyyy better understanding now.
I appreciate everyone who has commented and shared advice.
This would be very simple to complete outside of python, but I guess if I had 10000 features, python would prove more useful.
Thanks again!