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 need a way to programatically merge grid cells (polygon 15x15m) that are directly on top of each other and add together some of their attributes.

I am working in ArcGIS 10.1 with the data stored as a polygon feature class.

The data is the result of pedestrian survey across a pre-defined grid. On occasion the folks conducting the pedestrian survey get off course and record something in a column or row adjacent to the one they are working in (or the GPS position wanders). This results in two sets of data being recorded for each cell when the data from multiple GPS units are appended into a single feature class. I need a way to go through each cell, check to see if there are any duplicate features, if there are then merge their attributes (some integer, some text), and then delete the one feature that didn't get the merged data.

The 'Delete Identical' and 'Find Identical' tools don't do what I'm looking for - and doing it manually isn't an option as the feature class often has upwards of 10,000 features in it.

I know how to iterate through the feature class using python and check to determine if there are any duplicate features in that location. What I don't know how to do is deal with merging the features and updating the attributes. If anyone can offer some direction on how to accomplish this I would greatly appreciate it.

EDIT - More Description of Before/After State: In the picture below there are two features selected - identical 15x15 meter square polygons, I need to add together all the integer fields (the ones with TOT_ as a prefix) and append the GPS_UNIT, INITIALS, and REC_DATE string fields.

It's difficult to show since the features directly overlap.

enter image description here

EDIT 2: I have found that I can easily identify the duplicated features by calculating their XY centers, concatenating them into a string field as [X] & ',' & [Y] then opening the database in access and using a Find Duplicates query to identify which of the cells have been duplicated. I have not however, been able to figure out a good way to merge the attributes for each of the cells into a single row. Help with how to do that, either in python or in a database environment, would be very welcome!

share|improve this question
1  
Can you post a small sample area with "before and after correction" states? –  blah238 Jan 9 '13 at 6:03

2 Answers 2

Since you know how to iterate and find the features that you want to merge, I would build a function to do the merge which could probably be arcpy.Dissovle_management(). Do the dissolve and you can probably use the aggregating parameters to combine the attributes then delete those features from the original and update the data back with a insert cursor.

How do you identify which features need to get merged?

share|improve this answer
    
So far the best way to ID features to merge is to iterate through and do a select by location using the selected feature as the source and the layer as the target. Then, I use arcpy.getCount to see how many features are selected, if it's more than one, then I need to merge the attributes of all the selected features into one and delete the others. –  Kevin Jan 9 '13 at 15:09

Since you are only wanting to merge attributes for cells (actually polygons) that are identical then I would use Union and keep all the attributes. That way you can iterate through all resultant polygons (cells) and have access to both sets of original attributes to write whatever new values you want. If the same attribute names are used by both original feature classes you may need to do some renaming of fields before the Union so that both remain available.

Actually, a quick re-read of your question tells me that you have only one input feature class. Union may still be useful because it can run against a single feature class as described here.

share|improve this answer
    
I hadn't thought to use Union instead of Append when combining the data from each GPS unit... Doing that would eliminate the issue of spatial overlap and then I would just have to deal with the easier. Any thoughts on issues that may arise when union-ing upwards of 20 feature classes at a time? –  Kevin Jan 9 '13 at 16:09
    
Only that you probably need to have Advanced (ArcInfo) licensing if you want to do it in one go. With Basic and Standard you would need to do Unions in pairs and aggregate the results. –  PolyGeo Jan 9 '13 at 22:19

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.