Select to view content in your preferred language

Compare pre-edit geometry with edited geometry

687
2
03-03-2022 07:05 AM
Bud
by
Esteemed Contributor

In an Arcade attribute rule:

Is there a way to compare a feature's geometry before the edit was made...
vs.
...the edited geometry?

Example:
If the pre-edit geometry is different from the edited geometry, then do x to the geometry.
Else, do nothing.

Related: Attribute Rules: Update only on geometry change

I was hoping I'd be able to use $feature.shape as to get the pre-edit geometry. But that failed. Which is weird, because I can use $feature.shape_length without issue.

0 Kudos
2 Replies
KimGarbade
Frequent Contributor

Equals(geometey($feature),geometry($originalfeature))

Not sure you NEED the geometry functions but it doesn't hurt.

Not near a comouter, but i think you can use IsEmpty to determine if the feature existed before it was edited (i.e reshaped, moved, or added)   

Bud
by
Esteemed Contributor

For my records, here's where the $originalfeature global variable can be found in the docs:

Attribute Rule Calculation

Globals

Variable Name Type Description
$datastoreFeatureSetCollectionA collection of layers in the same feature service or database as the$featureexecuting the script.
$editcontext.editTypeTextIndicates whether the edit event isINSERT,UPDATE,DELETE, or NA(not applicable).
$featureFeatureThe feature being calculated.
$originalFeatureFeatureThe previous state of the feature being calculated.
$featureSetFeatureSetA collection of features in the same table as the$featureevaluating the expression.


Related: 

 - Identify whether a specific attribute value has changed
 - Arcade: Editing M-values not treated as change to geometry

0 Kudos