Removing spatially duplicate features using ModelBuilder?

You should try this, Add XY coordinates to your featureclass, then Dissolve on the X,Y fields. This should remove your stacked, duplicate features. You can then join the attributes from your source file. You may need to concatenate X,Y to form a single field for the join.


Here is a model that looks like it duplicates the process you have listed above. There are a couple of things different than the procedure you have outlined above.

Instead of using a while loop to increment through the features, there is a Feature Selection Iterator that loops directly over the features in a featureclass. What is nice about this iterator is that there are two outputs, the selected feature, and an attribute value of that feature. If you don't specify the attribute, it defaults to the Object ID, which is what you need to deselect the initial feature.

The value that is returned is used as part of the expression for the Select Layer by Attribute tool. It is referenced as an Inline Variable. This removes the initial feature from the selection.

The last interesting bit is the use of Feedback in the iteration. This is represented by the blue line from the "Output Feature Class", to the "Input features". This allows you to tell the input features to use the output feature class as their source, after the initial parameter definition. This removes the need for a counter to effect a loop of some sort.

I have not tested this, and there are a couple of places I am not sure of, for example the correct way to set up an expression using the OID field on the layer. This may be tricky because the field name has to be surrounded with brackets or double quotes depending on if it is coming from a personal or a file GDB respectively.

Hopefully this will give you some ideas to work with to structure your model.

Here is a link to a screenshot of the model: Remove Duplicates Model

Remove Duplicates Model


You may want to look at XTools and ETGeoWizards. XTools has a tool called Find Duplicates in the Table section. ETGeoWizards has a tool called remove Exact Duplicates under the Geoprocessing section. You can use both tools in a Model in Model Builder.