Select records with the bigger areas -  Urgent

09-09-2012 10:31 PM
New Contributor
Hello. I need your help on the following matter.
I have two shapefiles, one is cadastral parcels and the other one is planning zones. when i intersect those two shapefiles (using intersect from arctoolbox) i have a new one, containing parcels and planning zones. Now my problem is that i want to keep only those records that have the two bigger areas.
For example, if one parcel is divided to three parts by 2 planning zones i want to keep only the two records of that parcel which have the bigger areas and do that for all of my records.
Note that every parcel has a unique id number and when intersected with planning zones, keeps that unique number. So in the previous example my new shapefile will  have three records with the same unique number (because the parent parcel is the same), with different areas, depending where they've been divided by planning zones.
Any ideas? Also i'm not much of a programmer so if you have any ideas about scripting it would be a great help if you provide guidlines, or much better the script.
Thanks in advance.
0 Kudos
2 Replies
Regular Contributor II
What do you want to happen to the smaller one(s)? Delete them? sounds like it

You could use a serach cursor to get a list of the parcel IDs
loop through that list (one at a time), making a temporary layer of just that parcel ID

get the areas of the polygons in that layer (which will all be from the same parcel)

make a second temporary layer from that layer, selecting the ones with an area smaller than the second largest.

delete everything in that second layer.

remove the layers (so you can use the layer names again)

move to the next parcel ID and repeat

You could also try looping through the file once,
making a set of nested dictionaries, something like this:

dict = {
parcel1:{ {OID1:area}, {OID2:area}, {OID3:area},
parcel2:{ {OID11:area}, {OID12:area}, {OID13:area},
parcel3:{ {OID21:area}, {OID22:area}, {OID23:area},

Then you could examin the areas for each parcel, building a list of OIDs to be deleted...

but that could/would get complicated very quickly...
0 Kudos
MVP Esteemed Contributor
An approach you may want to try

1. Add a unique field (add a Long field, populate it with OBJECTID)
2. Copy Rows to create a standalone table
3. Sort to put the rows in the order you need
4. Tag your fields however you want ( you could do this in Excel if you don't need to batch this process ). The approach depends on how you want to tag them (top two, top three, all but smallest, etc).
5. Add a tag field to your original intersected dataset, join your original intersected dataset to your table and copy over tags for use with Eliminate or whatever tool you want.
0 Kudos