I need help with creating a rule to calculate the slope of sanitary sewer runs. I have always calculated it as UPELEV-DOWNELEV/Shape.Length
I used to manually do this in ArcMap but I would do it in batches after I finished an area. I was able to create a rule using the code below. I am not a coder but when I try to check it to see if it is working properly I get another answer that is pretty different. For example, a line returns a slope of 0.045 using the below code but when I manually do the calculation using the UPELEV, DOWNELEV, and SHAPE.Length() I get a slope of 0.013. I have tried to replace Length(Geometry($feature)) in the code with SHAPE.Length() and it works in the rule but in the execution ArcPro kicks out an error.
Any help would be greatly appreciated.
// ************* End User Variables Section *************
// Limit the rule to valid asset groups
if (!Includes(valid_asset_groups, asset_group)) return $feature.slope;
if (IsEmpty($feature.UPELEV) || IsEmpty($feature.DOWNELEV))
{
return $feature.slope;
}
if (IsEmpty(Geometry($feature)) || Length(Geometry($feature)) == 0)
{
return $feature.slope;
}
return ($feature.UPELEV - $feature.DOWNELEV)/Length(Geometry($feature));