0

ArcMap 10.2 user, with Spatial Analyst only. No ArcServer or of sort.

I have abt 500+ polygon shapefiles, each containing 2 or more polygons. All of them has a NAME column and the rest of the columns may or may not be the same with each other, and may or may not has a AREA column.

My objective is to delete all the smaller polygons in each SHP, leaving only the largest one.

I know Definitive Query will not work on this as the largest/smaller polygon definition is rather relative. (Largest polygon in one SHP could be the smallest in another).

As I am hopeless with Python (still reading Dummies for Python), can anyone advise how do I go abt doing this in Python? Maybe I would need to create a AREA column for all SHP first with Python?

Another thing is the 500+ SHP is not the end, we are still adding to that folder on a weekly basis. So I would need something that we can run on with SHP consisting one or more polygons in the future.

Thanks for reading this.

1

I would do this as three steps:

  1. Make sure that you have a field that holds the area - I have called mine Shape_Area below and it was created using Add Field and then populated with values using Calculate Geometry
  2. Use the Sort (Management) tool to sort on Shape_Area in DESCENDING order
  3. Use the Select (Analysis) tool on the sorted shapefile created above to select out the polygon with FID = 0 (which, due to the sort, is the one with the largest area)
  • 1
    I agree with this answer, but it should be noted that for this to work, it assumes there is a Shape_Area field. This is a field that will be auto created by ArcGIS software if you convert the shapefiles into geodatabase feature classes. All you'd have to do is run the feature class to feature class tool with the input being a shapefile and the output being a geodatabase feature class and you'd end up with a Shape_Area field you could run this process using. – John Mar 20 '14 at 4:29
  • Good point @user2856159 - an alternative to converting it to a geodatabase is to use Add Item and then Calculate Geometry – PolyGeo Mar 20 '14 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.