Select to view content in your preferred language

Checking for duplicate geometries in constraint attributes rule

328
1
02-12-2024 04:09 AM
Labels (1)
TorbjørnDalløkken2
Frequent Contributor

Hi.

In one of my users workflows, they need to append a selection of features to a featureclass and I've created a pythonscript for doing this (appending data and corresponding field-mapping). The process of selecting features and appending might be done several times in the workflow, if the user sees the need to add more features. 

I see that some users might add the same feature several times, causing duplicate features in the featureclass and this genrerates problems further down in the workflow. To restrict adding duplicate feature I've tried creating a contraint attribute rule. This attribute rule actually returns a message saying that features with same geometry is not allowed, but it inserts the feature multiple times.

Do you see what might be wrong?

var vegteig = FeatureSetByName($datastore, "Vegteiger")
var isUnique = true;
for(var p in vegteig){
  if(Equals(Geometry($feature), Geometry(p))){
   isUnique = false;
   break;
 }
}
return isUnique

 

0 Kudos
1 Reply
Ed_
by MVP Regular Contributor
MVP Regular Contributor

Maybe look into the following scripts

Find Identical and/or Delete Identical

 

Question | Analyze | Visualize
0 Kudos