I have been working with the Data reviewer in ArcMap and am now exploring the Data reviewer and Attribute rules in Pro. Currently, I am trying to create a few constraint type attribute rules with Arcade, but for some rules I have not been able to get the right result. I don't have any scripting experience, so working with the Arcade expressions is still a bit of a challenge for me.
I would like to create a rule for a line feature class (FC1) stating that this line (except for lines of type 1) should always be on top of a line from another feature class (FC2). I have been able to create a rule with the Intersects function, but of course this rule still approves lines from FC1 that only cross or partly intersect lines from FC2. This is the rule I created:
var FC2 = FeatureSetByName($datastore, "FC2",["objectid"], true);
var int = Intersects(FC2, Geometry($feature));
if (First(int) == null && $feature.FC1TYPE != 1)
Now I would like to replace the Intersects function with a Within function, but I don't know how to do this. I have tried several options, but none of them seem to work properly. In most cases all edits/inserts are seen as actions that are violating the rule. It probably has something to do with the output of the function, either being featureset or a boolean. It's not yet clear to me when the geometry functions return a boolean or a featureset.
I know there are also a few ready-to-use rules which don't require custom Arcade expressions, but I would like to learn how to create these expressions. I have also looked at several examples of Attribute rules, but I find it difficult to translate these to my situation. Most of the examples are still a bit too complicated for me.
Can someone show me how I can recreate this rule with a Within function?
Thank you very much!
Hi Elin S ,
Interesting use case. Can yo explain a little more about why a line has to coincide with lines from another featureclass?
A couple of notes on how you might want to do this and if you really should be doing this:
Thank you very much for your help. I am new to this all, so the rules I am creating now are just to get an idea of what is possible and to get more acquainted with Arcade. I can understand that one might want to be careful with the number of geometry-on-geometry constraint type rules, in order to keep a good performance.
The case I am working with involves culverts and waterways. The culverts (<> type 1) should coincide with waterways. In the Datareviewer in Arcmap I used the geometry on geometry check (spatial relation type: Within, ) to identify features that are not in that relationship. I am now trying to redo this check as a constraint attribute rule.
What do you think would be the best approach for this situation?
I have seen some examples in UC videos, but I still find it difficult to translate these to my own situation. Do you know if there is going be some kind of Arcade course for beginners on the Esri academy?
Thank you so much!
Hi Elin S ,
As far as I know, there isn't a course on Arcade (yet). However, there are quite a number of resources available. Apart from the official documentation: https://developers.arcgis.com/arcade and the repository on GitHub: https://github.com/Esri/arcade-expressions there have been a number of blog posts with examples.
Especially interesting are the explanations on FeatureSets in blog post written by Paul Barker:
Also Kelly Gerrow wrote an interesting blog on working with overlapping feature in Arcade:
I have a post here where I use FeatureSetBy functions to drill down layers:
Since you are interested in using attribute rules, here are a couple of interesting things you may want to read:
I could set up some test Arcade expressions, but that would require access to a small sample of your data.
Thank you so much for all these helpful links. It's a pity that there's no beginners course on Arcade yet, but hopefully I will be able to get started with the help of these resources and a bit of trial and error. If I don't succeed, I would be very happy to get some help with a few test expressions. But I will give it a try first.
Thanks for your help!