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
You may have more luck using the Add Surface Information geoprocessing tool. It needs a vector feature and an elevation raster as the inputs, and you can choose attributes to add to the line; minimum elevation, maximum elevation and slope are the properties I find most helpful.
You do need the 3D Analyst toolbox for this, and I am assuming you have access to the DEM if you already have a contours layer. I'm also assuming you have the ability to add attributes to the line feature class.
Hi rmathewmann,
Thanks for the quick response. I am familiar with that approach in ArcGIS Pro, but am hoping to achieve something similar in AGOL.
Best,
Aaron