AnsweredAssumed Answered

ModelBuilder - Delete Largest Polygon

Question asked by milestautscher on Apr 4, 2013
Latest reply on Apr 5, 2013 by MSummers-esristaff

I have a polygons feature class inside a model and I need to delete the largest polygon. The logic I've followed so far is:

- Convert the polygons to a feature layer so that I can use select by attribute
- Select By Attribute (New Selection) all features using the SQL expression "Id > 0"
- Select By Attribute (Remove from selection) the largest feature using the SQL expression Shape_Area=(SELECT MAX(Shape_Area) FROM polygons_Layer (2))

(From there I use copy features to make the selected features a new feature class).

This model works if the polygons feature class already exists (there is nothing wrong with the way the SQL expressions are written). However, since the model is designed to be transferable - and the polygons created within the model - it does not recognize either of the SQL expressions (when I click verify, it says "There was an error with the expression.")

Any ideas how to get around this? Obviously I'm open to completely different methods but the end result has to be a new polygon feature class with the largest polygon removed.