Delete features without creating new output with ArcPy

1495
2
Jump to solution
01-03-2018 12:50 PM
MKF62
by
Occasional Contributor III

Is it possible to delete features from an existing dataset without creating a new output feature class with ArcPY?

I have a dataset I'm working with and it gets altered over and over again throughout the whole script. Creating a new output feature class every time is going to get very very confusing. Is there no way to delete features without creating a new output file? It's not like you can select records and delete them from the main dataset since Select creates a new output file as well. Anything you delete from a selected set won't be reflected in the "real" dataset since selections are separate files. Am I wrong in this logic? 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
MKF62
by
Occasional Contributor III

I figured out how to do it, I think. I was using Select but you could use MakeFeatureLayer and then use SelectLayerByAttribute on that. Then you can delete the selected set using DeleteFeatures without creating a new output shapefile/feature class. It does appear to do what I need it to do, whether it's truly the "right" way to do it or not.

View solution in original post

0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

Like ... Delete Features.... it doesn't require a new output, it deletes what is selected, so you will have to focus on how you are making your selection

MKF62
by
Occasional Contributor III

I figured out how to do it, I think. I was using Select but you could use MakeFeatureLayer and then use SelectLayerByAttribute on that. Then you can delete the selected set using DeleteFeatures without creating a new output shapefile/feature class. It does appear to do what I need it to do, whether it's truly the "right" way to do it or not.

0 Kudos