Calculation rules are used to automatically populate attribute configurations on a feature. The practical use cases are discussed at the blogpost Maintain Measure Attributes. The following Arcade code may be used to configure an Attribute Rule that will populate measure attributes in designated fields when new linear referenced routes are created. The script will also update measure attributes when routes and/or their calibration is changed.
/**
* Assigned To: Polyline Feature Class that is M-aware
* Type: Calculation
* Name: StartM_EndM_Values
* Description: Calculate start Measure and end Measure values of Polyline-M feature
* Trigger: Insert, Update
* Misc: Exclude from Application Evaluation: True
* Feature must have GLOBALID, FromMeasure, ToMeasure, Length fields
*/
var geom = Geometry($feature);
if (!geom.hasM) {
return;
}
// Get Start/End Points
var start_p = geom['paths'][0][0];
var end_p = geom['paths'][-1][-1];
var start_m = Round(start_p.m);
var end_m = Round(end_p.m);
var length = Round(end_m - start_m);
return {
"result": {
"attributes": {
"FromMeasure": start_m,
"ToMeasure": end_m,
"Length": length
}
}
}