Attribute Rules RULE

Attribute Rules RULE

So, recently I’ve been digging deep into Esri's attribution documentation for ArcGIS Pro and stumbled upon something I wish I had known about years ago—cue Attribute Rules! I haven't implemented these yet in practice, but honestly, they would have been a lifesaver back when I was working on dozens of iterations (per project) of stream/wetland mitigation concept maps. Having certain fields auto-calculate could have saved me so much time and hassle, and just plain wrong math. Now that I know about them, I’m excited to see how they can streamline workflows and handle repetitive tasks.


The example below is a specific use case for calculating stream credits based on mitigation type; it’ll give you a peek at what you can do with Attribute Rules.


Before we dive in, here’s what you’ll need:

  • A Feature Class with an attribute field called mit_type (with domain values for Restoration, Enhancement I, Enhancement II, and Preservation), ratio, length, and credits, and globalID field.
  • Permissions to add or modify Attribute Rules
  • Some basic understanding of Arcade Expressions
  • Some familiarity with ESRI's Attribute Rules Documentation


Let’s Get Started

  1. Within your ArcGIS Pro project, navigate to the geodatabase containing your feature class. Right-click on the feature class and select Design; then select Attribute Rules.
  2. In the Attribute Rules View, click the Add Rule button to create a new rule.
  3. Choose Calculation for the rule type, as we’ll be calculating values automatically.
  4. Under the Trigger section, set it to fire When Attributes Are Updated and Inserted so the rule activates when the mit_type field is changed or when a new feature is added.
  5. Choose the field where you want the result to be stored—let’s select the ratio field for this example.
  6. In the Expression section, click on Edit to open the Arcade Expression Builder. You can use the example code below.
  7. Validate your Arcade expression to ensure it’s correct, then Save the rule.
  8. Test your new rule!

Attribute Rule dialog from the example

Arcade expression from this example:

var mit_type = $feature.mit_type;

if (mit_type == "Restoration") {
    return 1;
} else if (mit_type == "Enhancement I") {
    return 1.5;
} else if (mit_type == "Enhancement II") {
    return 3;
} else if (mit_type == "Preservation") {
    return 10;
} else {
    return null;
}        


Diving a bit deeper

Now that our ratio field is automatically updated by the Attribute Rule we just created, let’s explore other possibilities. We could set up rules to auto-calculate areas, or use the ratio to calculate credits. Below, you’ll see a gif of three rules working together. These rules include:

  1. The ratio determination rule that updates the ratio column (from the example).
  2. Automatic calculation of length in feet.
  3. Automatic calculation of credits based on the length and ratio columns.


Multiple rules in action


Considerations

  • Performance: Keep in mind that complex rules can impact performance, especially when applied to large datasets. Test your rules on a smaller sample before scaling up.
  • Dependencies: Attribute Rules can have cascading effects, so ensure any automated calculations don’t unintentionally disrupt other processes or datasets. This is when enabled and disabling the rules will come in handy.
  • Testing: As with any automation, thorough testing is key. Test your rules under various conditions to ensure they perform as expected.

With a bit of planning and some creative thinking, Attribute Rules may prove to be a game-changer for your projects.


Next week, we'll dive into thinking about your geoprocessing strategy.


GIS you later!


Pro Tip: Never stop exploring—even if the documentation doesn’t seem immediately relevant. You never know what you’ll discover! There are countless methods and tools out there that could make your GIS workflows easier and more efficient; and who doesn’t want that?

Brandy Manka Hayes

Regulatory Manager, TN & GA at RES

6 个月

Wow! Definitely going to try this out.

Timothy Swartzfager

Stream Restoration Designer/CAD Specialist

6 个月

I cannot wait to test this! I swear just yesterday I was complaining that there wasn't an easy way to recalculate the geometry in an attribute table. Thanks Megan, you're the best!

Alshaikh Khalifa

GIS Analyst | Surveying Engineer | Freelancer | ????

6 个月

Interesting

要查看或添加评论,请登录

Megan Engel, GISP的更多文章

社区洞察

其他会员也浏览了