I am creating a model to remove features which are duplicated within a polygon feature class. Most of the features are duplicated once, but about a quarter have up to three or four exact copies. I do not have ArcInfo, so I cannot use Delete Identical
.
My model should contain the following:
Make Feature Layer
on the input feature class specified by the user to outputOutput_FL
Get Count
to count the number of rows within the feature class- Create a variable
counter
and initialise to 0 - Add a
While
iterator wherecounter < row count
Select Layer by Attribute
onOutput_FL
to create aNEW_SELECTION
whereOBJECTID
=counter
Select Layer by Location
onOutput_FL
where the relationship isARE_IDENTICAL_TO
Select Layer by Attribute
onOutput_FL
toREMOVE_FROM_SELECTION
whereOBJECTID
=counter
Delete Features
fromOutput_FL
- Increment counter
I have finished all the steps except step 9. I am not sure where/how I should increment the counter. I'm also not sure if I should put a Copy Features
tool somewhere before the while
loop as a backup mechanism since this model will be modifying the input data, and not everyone will make a backup of their data before running the model.
-
How do you integrate 'Feature OID' in the SQL query ??? I try "%Feature OID%" = OID and other type of request and its not workinguser19717– user197172013年08月12日 17:19:35 +00:00Commented Aug 12, 2013 at 17:19
-
You may want to have it a go the solution in gis.stackexchange.com/a/219606/28687fatih_dur– fatih_dur2016年11月30日 05:35:28 +00:00Commented Nov 30, 2016 at 5:35
3 Answers 3
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.
-
+1 - I may have duplicated her model, but this is a far simpler solution.Get Spatial– Get Spatial2012年06月07日 14:49:16 +00:00Commented Jun 7, 2012 at 14:49
-
I first tried intersecting the feature class once, which extracted the polygons where it overlapped itself, then joined it to the original feature class and deleted the matches. I forgot that it would extract each duplicate as well, so this method did not yield my intended outcome. I am going to try your method first as it seems it will be the fastest, before attempting the model again.Cindy Jayakumar– Cindy Jayakumar2012年06月08日 05:30:38 +00:00Commented Jun 8, 2012 at 5:30
-
I used the
Shapes to Centroids
tool from XTools Pro so that each duplicate poly would have the same centre point. I added the fieldCONCAT_XY
to my original polygon feature class. After adding XY coordinates to the centroids, I used a spatial join to join it to my original FC. I then dissolved based onCONCAT_XY
, imported my original table structure from the XML schema, and loaded all attributes. Out of ~29 000 features, I now have ~24 500, which means about ~4 500 polys were duplicated. Thank you for the guidance!Cindy Jayakumar– Cindy Jayakumar2012年06月11日 05:21:55 +00:00Commented Jun 11, 2012 at 5:21 -
This is simple yet genius! Thank you.sparky– sparky2022年12月26日 16:23:21 +00:00Commented Dec 26, 2022 at 16:23
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
-
What is the 'Select Identical Features' tool in this model? There is no built-in tool by that exact name (there is a Find Identical tool, but this also requires ArcInfo).blah238– blah2382012年06月07日 16:57:05 +00:00Commented Jun 7, 2012 at 16:57
-
@blah238, It is actually the Select by Location tool, with the relationship being "Is Identical To". I'm going to update the model with some notes, then update the post.Get Spatial– Get Spatial2012年06月07日 16:59:09 +00:00Commented Jun 7, 2012 at 16:59
-
Could you please provide a link to the image of your model? All the ideas you have given sound great!Cindy Jayakumar– Cindy Jayakumar2012年06月08日 05:24:47 +00:00Commented Jun 8, 2012 at 5:24
-
@Cindy - If you right click on the image in the answer, you should be able to view it. It will be larger. You can also just right click and save the image.Get Spatial– Get Spatial2012年06月08日 05:34:05 +00:00Commented Jun 8, 2012 at 5:34
-
That's the problem, I cannot see that there is an image in your answer, I only know there is because you mentioned it, there isn't even a red X or "Image cannot be displayed" or alternate text to indicate that there is an image supposed to be there. This has been a problem for me when accessing this site from work, I can never "see" the images people refer to in their questions and answers. I don't think it's a browser problem, as I have the latest versions of Firefox and IE, both are set to "Show Pictures" and still I can't see anything.Cindy Jayakumar– Cindy Jayakumar2012年06月08日 06:12:36 +00:00Commented Jun 8, 2012 at 6:12
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.
-
We unfortunately do not have a licence for ETGeoWizards, and we have been having major problems with our IT department,as in they remove things from our machines randomly such as XTools, which I cannot install again, and anyway, no licence for Pro. So far we have been manually merging/deleting all the overlap errors (thousands and thousands and thousands...) and needless to say, it is not working out. I also want to create this model so that it is readily available to us for future projects.Cindy Jayakumar– Cindy Jayakumar2012年06月06日 13:16:50 +00:00Commented Jun 6, 2012 at 13:16
-
erm... Now that I have XTools installed again, I used the Find Duplicates tool, which gave the same results as my model. Thanks for pointing it out.Cindy Jayakumar– Cindy Jayakumar2012年06月13日 06:29:32 +00:00Commented Jun 13, 2012 at 6:29
Explore related questions
See similar questions with these tags.