17

Is it possible to uniquely identify each geometry in a feature layer?

Essentially I have a polygon feature layer with many rows of data represented by the same geometry. I would like 1 row for each unique geometry. So I'm looking for some out-of-box methodology to combine attributes based on the shape of the geometry.

I come from a Postgres world and can solve this problem there, but I don't know how to do it (or if it's possible) to do it non-programmatically with ESRI tools.

4
  • So you're saying that there are multiple records of identical geometry and you want to combine those which are identical? If that's the case...could you just dissolve based on area or something like that? Maybe I'm missing your question here. Commented Jul 25, 2013 at 20:19
  • That's correct, they are identical geometries where the only shared natural attribute is the geometry itself. Area may work, but there isn't a guarantee that two different geometries don't have the same area. Commented Jul 25, 2013 at 20:45
  • See my post. You can run dissolve on multiple fields.
    – Paul
    Commented Jul 25, 2013 at 21:11
  • @Paul....I see you edited your response to reflect my input. I hope that helped. Commented Jul 26, 2013 at 11:46

3 Answers 3

22

If you have an advanced license, you can use Find Identical or Delete Identical.

Both can be used to find/delete features that have identical attributes, or, if the Shape field is specified, identical geometries.

If you don't have an advanced license, Removing spatially duplicate features using ModelBuilder? will be useful.

In short, you add two fields for X,Y in your attribute table and run a Dissolve on said fields.

If you have polygons which share the same centroid, but are not geometrically identical, you can add two other fields (Perimeter and Area). That should be enough to identify identical geometries for almost all normal cases. See @whuber's comments below.

7
  • That's presuming point data correct? I had thought about suggesting to create centroids first. He's still saying there are many rows of the same geometry...It almost sounds like classifying based on an acreage class/range? But it also says shape of the geometry...which is why I was leaning towards dissolving based on area or perimeter (or a combination of the two of them to attain a ratio). Commented Jul 25, 2013 at 20:30
  • 1
    Actually, that post I linked was for polygons. You could dissolve on area and centroid, on the off chance that you have two non-identical polygons with the same centroid.
    – Paul
    Commented Jul 25, 2013 at 20:35
  • 1
    +1 This is exactly the right answer. In principle the centroid, perimeter, and area might still not uniquely identify a polygon, but the counterexamples are a bit contrived. For hashing irregular or natural or manually digitized objects to unique ids, those four values should be reliable. If you want some more easily-obtained values, use coordinates of the feature's bounding box and its vertex count.
    – whuber
    Commented Jul 25, 2013 at 21:15
  • @whuber Would comparing the coordinates of all the vertices be the only surefire way to determine identical geometry? My background in geometry is pretty weak, so I find this all pretty fascinating.
    – Paul
    Commented Jul 25, 2013 at 21:25
  • The answer to your question depends on what you mean by "identical": for instance, if you were to insert a new vertex along the edge of a polygon, is that an "identical" polygon or not? Arguably it is in the sense of representing the same feature in the world, even though the vertices differ. From this point of view about the only sure test is whether the (set theoretic) difference of the two polygons is empty or not. But if you take the stricter view that identity means a vertex-to-vertex match, it's still tricky, because one polygon could start its vertex list at a different point.
    – whuber
    Commented Jul 25, 2013 at 21:32
1

I have a dataset based on survey data. My problem is that old features do not always get removed before the new survey shots are imported. Therefore we have 'duplicates' with different geometry: IE the survey shots might be 1/4 ft separate from each other. On a 12000 feature dataset this is difficult to zoom into each and identify them. Using ArcMap Basic 10.2: here's a hacky model I came up with.

  1. Buffer(w/input radius) each feature in original layer (Selected or Not)
  2. Iterate over each feature in buffer layer
  3. Select from original layer based on relationship (Centroid w/in feature)
  4. "Row count" selected features
  5. Field Calculate Row count value to buffer layer = How many features are within radius of original features

I re-invented the wheel. Also, I got frustrated with Model builder and basically bulldogged the whole thing. There has to be a more elegant solution. I will gladly accept critiques and suggestions.

Also, this seems to only run correctly from within Model Builder, I run from a toolbox and it does not save the buffer layer.

Find Duplicate Featuers

1

I have been looking for an answer to the same question for some time to overcome flattening the overlapping buffer polygons issue and think found a robust solution to that. In fact @Whuber's comment,

In principle the centroid, perimeter, and area might still not uniquely identify a polygon, but the counterexamples are a bit contrived.

on @Paul's answer was the main drive for me to keep trying. It uses Spatial Join tool's ARE_IDENTICAL_TO operator since this is the most efficient among other identical detectors. Here are the steps:

  • Self Union your input to keep all shapes different than each other;
  • Create a dummy field to keep/copy original OBJECTID's (i.e., OID field type) of the rows, say EX_OID;
    • Run Spatial Join on the feature class that is wanted to be processed as both target and join feature parameters. Make sure the field mappings of dummy field(s) (appears twice) previously created has the merge rule of FIRST (which is the default or pick LAST, the others may not give the desired output since they use a summary of overlaps). This step picks the common shape OBJECTID sitting on top of all overlapping (i.e., FIRST);

Following steps can be done in two ways, WITH Python or WITHOUT:

WITH PYTHON

  • Use the code below to extract unique IDs that we want to find:

print tuple(set([row.getValue("EX_OID_1") for row in arcpy.SearchCursor("Output_of_the_Spatial_Join_Operation")])).

Be aware that I am using the second copy of dummy OID field, which is EX_OID_1 in my case;

  • Copy the output of this code and paste this into the Definition Query of the original feature class processed as OBJECTID IN (<PASTE_COPIED_VALUES_HERE>). The result will be showing you the unified features of the overlapping parts. There is a size limitation here though, 30,000 characters. To overcome this issue, you need to follow "without python" steps.

WITHOUT PYTHON

  • Use Frequency tool to list unique values in the second copy of dummy OID field, which is EX_OID_1 in my case;

  • Lastly Join OBJECTID field of the original feature class with the output of the Frequency tool's EX_OID_1 by selecting "Keep only matching records" options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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