Hi,
I have a very simple need: I want to delete a feature class from an ArcGIS Pro project permanently.
arcpy.Delete_management only seems to delete the layer from the map, but not the feature class. How can I delete the feature class permanently? (Apart from arcpy I could also use the ArcGIS Pro SDK, just in case somebody knows a way to do it there)
Thanks in advance
Christian
Solved! Go to Solution.
How are you coming to the conclusion that the FC is still there? If it is the Catalog pane in Pro, you need to hit F5 to refresh the contents of the FGDB.
I think you would get better luck with this question in sub-space https://community.esri.com/community/developers/gis-developers/python
Thank you, I moved the question to the Python sub-space.
My guess is that you passed the layer name to Delete and that is why only the layer was deleted. If you want to delete a feature class, you need to pass the full path to the feature class to Delete so that it knows you are wanting a feature class and not a layer or some other object with the same name removed.
Thanks for your reply. I tried to specify the full path but I wasn't successful.. maybe I'm missing something. Here's the code I typed into the interactive python prompt in ArcGIS:
arcpy.CreateFeatureclass_management(arcpy.env.workspace, "test_fc", "POLYGON")
<Result 'C:\\Users\\Tom\\Documents\\ArcGIS\\Projects\\Example\\Example.gdb\\test_fc'>
arcpy.Delete_management('C:\\Users\\Tom\\Documents\\ArcGIS\\Projects\\Example\\Example.gdb\\test_fc')
<Result 'true'>
However, the layer in the map is gone.. but the feature class is still present in the Example.gdb. What am I doing wrong?
How are you coming to the conclusion that the FC is still there? If it is the Catalog pane in Pro, you need to hit F5 to refresh the contents of the FGDB.
*facepalm* You're right of course.. I assumed that the Catalog pane would update itself automatically just like everything else does in ArcGIS Pro to reflect changes. But turns out it didn't. Thanks a lot!