Hey y'all,
I am trying to calculate the length of intersecting trail that runs through a feature using arcade so that a popup can be calculated on the fly. The value I'm returning seems incorrect and I'm struggling to fix it. For example, a feature that has ~1.1 miles of trail intersecting returns a value of 3.3 miles. The code may be returning the entire length of the trail, regardless of how much intersects the feature. If this is the case, how can I calculate the length of the trail that actually intersects the feature?
// Access the Trails layer by name
var trailsLayer = FeatureSetByName($map, "Trails");
// Find intersecting trails within the selected feature
var intersectingTrails = Intersects(trailsLayer, $feature);
//Calculate length of intersecting trails
var totalLength = Length(intersectingTrails, "miles")
// Return the total length in the desired units (e.g., meters or miles)
if (totalLength == 0) {
return "There are no public trails on this property.";
} else {
return Round(totalLength, 2) + " miles";
} Thanks in advance for your help!