Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I got a Feature class with some identicial fields! Now i only need one polygon which had the same ID and this is the one with the largest size? Is there a posibility to delete the Polygons which are identical by size so that only the largest Polygons(from the ones with the same ID) are left?

For example:

ID   shape area

1    5
2    4
2    3
3    11
4    7
5    8
5    10

and i Need only the Polygons with the largest size that means the frist, second, fourth, fifth and the last!

share|improve this question
    
Welcome to GIS-SE! Unfortunately, your table has no formatting which makes it hard to understand what you are after. I'm going to give you some reputation by upvoting your question and at the same time will introduce some formatting into it that may help you to edit it. –  PolyGeo May 6 '13 at 11:43
    
Polygon or polygons? If polygons, then what is the cut off size value for deleting? In addition, you also want to delete duplicate size polygons? –  artwork21 May 6 '13 at 11:59
    
Polygon... if they have the same id, i only Need the one with the largest size... –  hans germany May 6 '13 at 12:03
1  
What should the output be when there are two or more polygons having the same largest size? –  whuber May 7 '13 at 2:17
    
it´s not possible that they have the same size! –  hans germany May 7 '13 at 14:34
add comment

3 Answers 3

I would run the dissolve tool.

  1. Open Toolbox
  2. Data Management Tools/Generalization/Dissolve
  3. Choose your file as the input
  4. Dissolve on the relavent fields (not sure what all your data looks like so I can't give a good recommendation here)
  5. In the statistics portion select the ID field and then Statistic Type: MAX

Run the tool and you should get the results you are looking for.

share|improve this answer
    
What exactly does Dissolve do to collections of shapes that aren't quite the same? –  whuber May 7 '13 at 2:15
    
it all depends on which fields you perform the 'dissolve' on. –  Craig May 7 '13 at 16:42
add comment

This script (python) will check the records in your layer and add the IDs and their sizes to a dictionary and end with each ID associated with the largest value, then select and delete anything that is not in that dictionary.

import arcpy
dict_IDs ={}
layer = arcpy.SearchCursor("YourLayer")

for i in layer:
    record= i.getValue('Id')
    if record in dict_IDs:
        if dict_IDs[record]<i.getValue('size'):
            dict_IDs[record]=i.getValue('size')
    else:
        dict_IDs[record]=i.getValue('size')

for record_id in dict_IDs:
    qry="Id= "+str(record_id)+" and size <> "+str(dict_IDs[record_id])
    arcpy.SelectLayerByAttribute_management("YourLayer","ADD_TO_SELECTION",qry)

arcpy.DeleteRows_management("YourLayer")
share|improve this answer
1  
One subtle, and probably unexpected and unintended, behavior of this solution is that records with duplicate values of [Id] that are tied for the largest value of [shape area] will all be retained, so the output can still have duplicates. –  whuber May 7 '13 at 2:15
    
A solution to the problem @whuber has mentioned would be to run this script first and then run a second, simpler script that simply deletes all [Id] field duplicates. This second script would produce your final output. –  Conor Nov 11 '13 at 17:06
add comment

Unless I have misunderstood what you are asking, a single tool can do this, it is the Delete Identical tool. The only caveat is that it requires Advance (ArcInfo) license level.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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