I’ve been using Arcade in AGOL to cobble together a script that returns the slope of a line based on the intersection between the start and end vertex of said line with contours created from LiDAR data. My plan is to create lines in an edit session and have the slope show up in the pop-up of the line. I guess the first problem is that I cannot get the line to snap to the contours, so I can’t test out the efficacy of the script. In any case, can folks with more scripting knowledge tell me if the script actually has a chance of returning the slope value?
// variables representing the start and end vertex of line
var first_point = Point(First(Geometry($feature).paths [0]))
var Last_point = Point(Geometry($feature).paths [0] [1])
//”Contours 5 ft” is the contour layer
//Field containing elevation value is “Contour”
var x = FeatureSetByName($map, "Contours 5 Ft")
for(var f in x){
if(Intersects(first_point, f)){
return f.Contuor
}else {
return null
}
}for(var g in x){
if(Intersects(Last_point, x)){
return f.Contour
}
}
var slope = (f-g/$feature.Shape__Length) * 100
return slope