Select to view content in your preferred language

Arcade expression Validation Atributte Rules

533
3
01-23-2023 08:40 PM
ammsgis
Emerging Contributor
 

Hey people, I need some help with issues about making arcade expressions. I made this one but i don't understand what is wrong, can someone help me?

My intent is create a capable rule to identify when a polygon feature overlaps another one. I tried to use the Ready to use Rules (Feature on feature) but it isn't work, so i began tried to write this code.

I thank you in advance,
Best regards.

 

0 Kudos
3 Replies
JohannesLindner
MVP Frequent Contributor

To post code:

JohannesLindner_0-1674546019020.png

JohannesLindner_1-1674546030601.png

 

 

Overlaps takes two geometries/features as arguments. You are trying to run it with two featuresets.

You have to get the intersecting features first, then loop over those features and test if they overlap the current $feature.

// get all polygons that are intersected by the current feature
var fs_polygons = FeaturesetByName($datastore, "HydrographySrf", ["*"], true)
var i_polygons = Intersects($feature, fs_polygons)

// loop over those polygons
for(var i_poly in i_polygons) {
    // if the polygon overlaps the current feature
    if(Overlaps($feature, i_poly)) {
        return false
    }
}
return true

 


Have a great day!
Johannes
0 Kudos
ammsgis
Emerging Contributor

Hi Johannes!How you doing?
Thank you for response!Can you answer some questions to clarify my thoughts?
Can I associate the variable i_polygons which will loop with the the feature PhisiographySrf ?Because i just wanna identify this overlapped features over the feature HydrographySrf.

0 Kudos
JohannesLindner
MVP Frequent Contributor

In which table do you want to create the validation rule?


Have a great day!
Johannes
0 Kudos